winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
728 discussions
Start a n
N
ew thread
Huw Davies : iphlpapi: Return the TCPIP device name in MIB_IFROW.
by Alexandre Julliard
09 Jul '21
09 Jul '21
Module: wine Branch: master Commit: f1349aa51496540254406c77c5dcbf8dfb42ff3b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f1349aa51496540254406c77…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 9 09:09:28 2021 +0100 iphlpapi: Return the TCPIP device name in MIB_IFROW. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/iphlpapi_main.c | 7 ++++--- dlls/iphlpapi/tests/iphlpapi.c | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index dac84ee2afb..4ff9feb57f2 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -1736,12 +1736,13 @@ DWORD WINAPI GetFriendlyIfIndex(DWORD IfIndex) return IfIndex; } -static void if_counted_string_copy( WCHAR *dst, unsigned int len, IF_COUNTED_STRING *src ); - static void if_row_fill( MIB_IFROW *row, struct nsi_ndis_ifinfo_rw *rw, struct nsi_ndis_ifinfo_dynamic *dyn, struct nsi_ndis_ifinfo_static *stat ) { - if_counted_string_copy( row->wszName, ARRAY_SIZE(row->wszName), &rw->alias ); + static const WCHAR name_prefix[] = {'\\','D','E','V','I','C','E','\\','T','C','P','I','P','_',0}; + + memcpy( row->wszName, name_prefix, sizeof(name_prefix) ); + ConvertGuidToStringW( &stat->if_guid, row->wszName + ARRAY_SIZE(name_prefix) - 1, CHARS_IN_GUID ); row->dwIndex = stat->if_index; row->dwType = stat->type; row->dwMtu = dyn->mtu; diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 1e8950f3482..893d6041287 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -275,7 +275,6 @@ static void testGetIfTable(void) guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); -todo_wine ok( !wcscmp( row->wszName, name ), "got %s vs %s\n", debugstr_w( row->wszName ), debugstr_w( name ) ); } }
1
0
0
0
Huw Davies : iphlpapi: Implement AllocateAndGetIfTableFromStack() on top of nsi.
by Alexandre Julliard
09 Jul '21
09 Jul '21
Module: wine Branch: master Commit: adea7b8f916dcf7b035d163d0729056266796991 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=adea7b8f916dcf7b035d163d…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 9 09:09:27 2021 +0100 iphlpapi: Implement AllocateAndGetIfTableFromStack() on top of nsi. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/iphlpapi_main.c | 99 +++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 41 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 375766f1e9c..dac84ee2afb 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -75,6 +75,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi); #define CHARS_IN_GUID 39 +DWORD WINAPI AllocateAndGetIfTableFromStack( MIB_IFTABLE **table, BOOL sort, HANDLE heap, DWORD flags ); + DWORD WINAPI ConvertGuidToStringA( const GUID *guid, char *str, DWORD len ) { if (len < CHARS_IN_GUID) return ERROR_INSUFFICIENT_BUFFER; @@ -130,47 +132,6 @@ DWORD WINAPI AddIPAddress(IPAddr Address, IPMask IpMask, DWORD IfIndex, PULONG N return ERROR_NOT_SUPPORTED; } - -/****************************************************************** - * AllocateAndGetIfTableFromStack (IPHLPAPI.@) - * - * Get table of local interfaces. - * Like GetIfTable(), but allocate the returned table from heap. - * - * PARAMS - * ppIfTable [Out] pointer into which the MIB_IFTABLE is - * allocated and returned. - * bOrder [In] whether to sort the table - * heap [In] heap from which the table is allocated - * flags [In] flags to HeapAlloc - * - * RETURNS - * ERROR_INVALID_PARAMETER if ppIfTable is NULL, whatever - * GetIfTable() returns otherwise. - */ -DWORD WINAPI AllocateAndGetIfTableFromStack(PMIB_IFTABLE *ppIfTable, - BOOL bOrder, HANDLE heap, DWORD flags) -{ - DWORD ret; - - TRACE("ppIfTable %p, bOrder %d, heap %p, flags 0x%08x\n", ppIfTable, - bOrder, heap, flags); - if (!ppIfTable) - ret = ERROR_INVALID_PARAMETER; - else { - DWORD dwSize = 0; - - ret = GetIfTable(*ppIfTable, &dwSize, bOrder); - if (ret == ERROR_INSUFFICIENT_BUFFER) { - *ppIfTable = HeapAlloc(heap, flags, dwSize); - ret = GetIfTable(*ppIfTable, &dwSize, bOrder); - } - } - TRACE("returning %d\n", ret); - return ret; -} - - static int IpAddrTableNumericSorter(const void *a, const void *b) { int ret = 0; @@ -1908,6 +1869,62 @@ err: return err; } +/****************************************************************** + * AllocateAndGetIfTableFromStack (IPHLPAPI.@) + * + * Get table of local interfaces. + * Like GetIfTable(), but allocate the returned table from heap. + * + * PARAMS + * table [Out] pointer into which the MIB_IFTABLE is + * allocated and returned. + * sort [In] whether to sort the table + * heap [In] heap from which the table is allocated + * flags [In] flags to HeapAlloc + * + * RETURNS + * ERROR_INVALID_PARAMETER if ppIfTable is NULL, whatever + * GetIfTable() returns otherwise. + */ +DWORD WINAPI AllocateAndGetIfTableFromStack( MIB_IFTABLE **table, BOOL sort, HANDLE heap, DWORD flags ) +{ + DWORD i, count, size, err; + NET_LUID *keys; + struct nsi_ndis_ifinfo_rw *rw; + struct nsi_ndis_ifinfo_dynamic *dyn; + struct nsi_ndis_ifinfo_static *stat; + + if (!table) return ERROR_INVALID_PARAMETER; + + /* While this could be implemented on top of GetIfTable(), it would require + an additional call to retrieve the size */ + err = NsiAllocateAndGetTable( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, (void **)&keys, sizeof(*keys), + (void **)&rw, sizeof(*rw), (void **)&dyn, sizeof(*dyn), + (void **)&stat, sizeof(*stat), &count, 0 ); + if (err) return err; + + size = FIELD_OFFSET( MIB_IFTABLE, table[count] ); + *table = HeapAlloc( heap, flags, size ); + if (!*table) + { + err = ERROR_NOT_ENOUGH_MEMORY; + goto err; + } + + (*table)->dwNumEntries = count; + for (i = 0; i < count; i++) + { + MIB_IFROW *row = (*table)->table + i; + + if_row_fill( row, rw + i, dyn + i, stat + i ); + } + if (sort) qsort( (*table)->table, count, sizeof(MIB_IFROW), ifrow_cmp ); + +err: + NsiFreeTable( keys, rw, dyn, stat ); + return err; +} + static void if_counted_string_copy( WCHAR *dst, unsigned int len, IF_COUNTED_STRING *src ) { unsigned int copy = src->Length;
1
0
0
0
Huw Davies : iphlpapi: Implement GetIfEntry() on top of nsi.
by Alexandre Julliard
09 Jul '21
09 Jul '21
Module: wine Branch: master Commit: d044171b72337ec530a9b9ab1334a08e9c91fbaf URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d044171b72337ec530a9b9ab…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 9 09:09:26 2021 +0100 iphlpapi: Implement GetIfEntry() on top of nsi. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/ifenum.c | 41 ----------------------------------------- dlls/iphlpapi/ifenum.h | 7 ------- dlls/iphlpapi/iphlpapi_main.c | 33 ++++++++++++++++----------------- 3 files changed, 16 insertions(+), 65 deletions(-) diff --git a/dlls/iphlpapi/ifenum.c b/dlls/iphlpapi/ifenum.c index 3b4ac775db7..8108c7ff8c2 100644 --- a/dlls/iphlpapi/ifenum.c +++ b/dlls/iphlpapi/ifenum.c @@ -745,47 +745,6 @@ DWORD getInterfaceStatusByName(const char *name, INTERNAL_IF_OPER_STATUS *status return ret; } -DWORD getInterfaceEntryByName(const char *name, PMIB_IFROW entry) -{ - BYTE addr[MAX_INTERFACE_PHYSADDR]; - DWORD ret, len = sizeof(addr), type; - - if (!name) - return ERROR_INVALID_PARAMETER; - if (!entry) - return ERROR_INVALID_PARAMETER; - - if (getInterfacePhysicalByName(name, &len, addr, &type) == NO_ERROR) { - WCHAR *assigner; - const char *walker; - - memset(entry, 0, sizeof(MIB_IFROW)); - for (assigner = entry->wszName, walker = name; *walker; - walker++, assigner++) - *assigner = *walker; - *assigner = 0; - getInterfaceIndexByName(name, &entry->dwIndex); - entry->dwPhysAddrLen = len; - memcpy(entry->bPhysAddr, addr, len); - memset(entry->bPhysAddr + len, 0, sizeof(entry->bPhysAddr) - len); - entry->dwType = type; - /* FIXME: how to calculate real speed? */ - getInterfaceMtuByName(name, &entry->dwMtu); - /* lie, there's no "administratively down" here */ - entry->dwAdminStatus = MIB_IF_ADMIN_STATUS_UP; - getInterfaceStatusByName(name, &entry->dwOperStatus); - /* punt on dwLastChange? */ - entry->dwDescrLen = min(strlen(name), MAX_INTERFACE_DESCRIPTION - 1); - memcpy(entry->bDescr, name, entry->dwDescrLen); - entry->bDescr[entry->dwDescrLen] = '\0'; - entry->dwDescrLen++; - ret = NO_ERROR; - } - else - ret = ERROR_INVALID_DATA; - return ret; -} - static DWORD getIPAddrRowByName(PMIB_IPADDRROW ipAddrRow, const char *ifName, const struct sockaddr *sa) { diff --git a/dlls/iphlpapi/ifenum.h b/dlls/iphlpapi/ifenum.h index 558dff64cb6..d0143eaaf69 100644 --- a/dlls/iphlpapi/ifenum.h +++ b/dlls/iphlpapi/ifenum.h @@ -87,13 +87,6 @@ DWORD getInterfaceIndexByName(const char *name, IF_INDEX *index) DECLSPEC_HIDDEN DWORD getInterfacePhysicalByIndex(IF_INDEX index, PDWORD len, PBYTE addr, PDWORD type) DECLSPEC_HIDDEN; -/* Fills in the MIB_IFROW by name. Doesn't fill in interface statistics, - * see ipstats.h for that. - * Returns ERROR_INVALID_PARAMETER if name is NULL, ERROR_INVALID_DATA - * if name isn't valid, and NO_ERROR otherwise. - */ -DWORD getInterfaceEntryByName(const char *name, PMIB_IFROW entry) DECLSPEC_HIDDEN; - DWORD getNumIPAddresses(void) DECLSPEC_HIDDEN; /* Gets the configured IP addresses for the system, and sets *ppIpAddrTable to diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index e5b6e72bde1..375766f1e9c 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -1821,26 +1821,25 @@ static void if_row_fill( MIB_IFROW *row, struct nsi_ndis_ifinfo_rw *rw, struct n * Success: NO_ERROR * Failure: error code from winerror.h */ -DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow) +DWORD WINAPI GetIfEntry( MIB_IFROW *row ) { - DWORD ret; - char nameBuf[MAX_ADAPTER_NAME]; - char *name; + struct nsi_ndis_ifinfo_rw rw; + struct nsi_ndis_ifinfo_dynamic dyn; + struct nsi_ndis_ifinfo_static stat; + NET_LUID luid; + DWORD err; - TRACE("pIfRow %p\n", pIfRow); - if (!pIfRow) - return ERROR_INVALID_PARAMETER; + TRACE( "row %p\n", row ); + if (!row) return ERROR_INVALID_PARAMETER; - name = getInterfaceNameByIndex(pIfRow->dwIndex, nameBuf); - if (name) { - ret = getInterfaceEntryByName(name, pIfRow); - if (ret == NO_ERROR) - ret = getInterfaceStatsByName(name, pIfRow); - } - else - ret = ERROR_INVALID_DATA; - TRACE("returning %d\n", ret); - return ret; + err = ConvertInterfaceIndexToLuid( row->dwIndex, &luid ); + if (err) return err; + + err = NsiGetAllParameters( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, + &luid, sizeof(luid), &rw, sizeof(rw), + &dyn, sizeof(dyn), &stat, sizeof(stat) ); + if (!err) if_row_fill( row, &rw, &dyn, &stat ); + return err; } static int ifrow_cmp( const void *a, const void *b )
1
0
0
0
Huw Davies : iphlpapi: Implement GetIfTable() on top of nsi.
by Alexandre Julliard
09 Jul '21
09 Jul '21
Module: wine Branch: master Commit: e93053c344a7c467702e1e1cdc6274e282b5a6c4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e93053c344a7c467702e1e1c…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 9 09:09:25 2021 +0100 iphlpapi: Implement GetIfTable() on top of nsi. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/iphlpapi_main.c | 131 ++++++++++++++++++++++------------------- dlls/iphlpapi/tests/iphlpapi.c | 16 +++++ 2 files changed, 87 insertions(+), 60 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index ff534afa0f9..e5b6e72bde1 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -1775,6 +1775,38 @@ DWORD WINAPI GetFriendlyIfIndex(DWORD IfIndex) return IfIndex; } +static void if_counted_string_copy( WCHAR *dst, unsigned int len, IF_COUNTED_STRING *src ); + +static void if_row_fill( MIB_IFROW *row, struct nsi_ndis_ifinfo_rw *rw, struct nsi_ndis_ifinfo_dynamic *dyn, + struct nsi_ndis_ifinfo_static *stat ) +{ + if_counted_string_copy( row->wszName, ARRAY_SIZE(row->wszName), &rw->alias ); + row->dwIndex = stat->if_index; + row->dwType = stat->type; + row->dwMtu = dyn->mtu; + row->dwSpeed = dyn->rcv_speed; + row->dwPhysAddrLen = rw->phys_addr.Length; + if (row->dwPhysAddrLen > sizeof(row->bPhysAddr)) row->dwPhysAddrLen = 0; + memcpy( row->bPhysAddr, rw->phys_addr.Address, row->dwPhysAddrLen ); + row->dwAdminStatus = rw->admin_status; + row->dwOperStatus = (dyn->oper_status == IfOperStatusUp) ? MIB_IF_OPER_STATUS_OPERATIONAL : MIB_IF_OPER_STATUS_NON_OPERATIONAL; + row->dwLastChange = 0; + row->dwInOctets = dyn->in_octets; + row->dwInUcastPkts = dyn->in_ucast_pkts; + row->dwInNUcastPkts = dyn->in_bcast_pkts + dyn->in_mcast_pkts; + row->dwInDiscards = dyn->in_discards; + row->dwInErrors = dyn->in_errors; + row->dwInUnknownProtos = 0; + row->dwOutOctets = dyn->out_octets; + row->dwOutUcastPkts = dyn->out_ucast_pkts; + row->dwOutNUcastPkts = dyn->out_bcast_pkts + dyn->out_mcast_pkts; + row->dwOutDiscards = dyn->out_discards; + row->dwOutErrors = dyn->out_errors; + row->dwOutQLen = 0; + row->dwDescrLen = WideCharToMultiByte( CP_ACP, 0, stat->descr.String, stat->descr.Length / sizeof(WCHAR), + (char *)row->bDescr, sizeof(row->bDescr) - 1, NULL, NULL ); + row->bDescr[row->dwDescrLen] = '\0'; +} /****************************************************************** * GetIfEntry (IPHLPAPI.@) @@ -1811,91 +1843,70 @@ DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow) return ret; } -static int IfTableSorter(const void *a, const void *b) +static int ifrow_cmp( const void *a, const void *b ) { - int ret; - - if (a && b) - ret = ((const MIB_IFROW*)a)->dwIndex - ((const MIB_IFROW*)b)->dwIndex; - else - ret = 0; - return ret; + return ((const MIB_IFROW*)a)->dwIndex - ((const MIB_IFROW*)b)->dwIndex; } - /****************************************************************** * GetIfTable (IPHLPAPI.@) * * Get a table of local interfaces. * * PARAMS - * pIfTable [Out] buffer for local interfaces table - * pdwSize [In/Out] length of output buffer - * bOrder [In] whether to sort the table + * table [Out] buffer for local interfaces table + * size [In/Out] length of output buffer + * sort [In] whether to sort the table * * RETURNS * Success: NO_ERROR * Failure: error code from winerror.h * * NOTES - * If pdwSize is less than required, the function will return + * If size is less than required, the function will return * ERROR_INSUFFICIENT_BUFFER, and *pdwSize will be set to the required byte * size. - * If bOrder is true, the returned table will be sorted by interface index. + * If sort is true, the returned table will be sorted by interface index. */ -DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder) +DWORD WINAPI GetIfTable( MIB_IFTABLE *table, ULONG *size, BOOL sort ) { - DWORD ret; + DWORD i, count, needed, err; + NET_LUID *keys; + struct nsi_ndis_ifinfo_rw *rw; + struct nsi_ndis_ifinfo_dynamic *dyn; + struct nsi_ndis_ifinfo_static *stat; - TRACE("pIfTable %p, pdwSize %p, bOrder %d\n", pIfTable, pdwSize, bOrder); + if (!size) return ERROR_INVALID_PARAMETER; - if (!pdwSize) - ret = ERROR_INVALID_PARAMETER; - else { - DWORD numInterfaces = get_interface_indices( FALSE, NULL ); - ULONG size = sizeof(MIB_IFTABLE); + /* While this could be implemented on top of GetIfTable2(), it would require + an additional copy of the data */ + err = NsiAllocateAndGetTable( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, (void **)&keys, sizeof(*keys), + (void **)&rw, sizeof(*rw), (void **)&dyn, sizeof(*dyn), + (void **)&stat, sizeof(*stat), &count, 0 ); + if (err) return err; + + needed = FIELD_OFFSET( MIB_IFTABLE, table[count] ); - if (numInterfaces > 1) - size += (numInterfaces - 1) * sizeof(MIB_IFROW); - if (!pIfTable || *pdwSize < size) { - *pdwSize = size; - ret = ERROR_INSUFFICIENT_BUFFER; + if (!table || *size < needed) + { + *size = needed; + err = ERROR_INSUFFICIENT_BUFFER; + goto err; } - else { - InterfaceIndexTable *table; - get_interface_indices( FALSE, &table ); - - if (table) { - size = sizeof(MIB_IFTABLE); - if (table->numIndexes > 1) - size += (table->numIndexes - 1) * sizeof(MIB_IFROW); - if (*pdwSize < size) { - *pdwSize = size; - ret = ERROR_INSUFFICIENT_BUFFER; - } - else { - DWORD ndx; - *pdwSize = size; - pIfTable->dwNumEntries = 0; - for (ndx = 0; ndx < table->numIndexes; ndx++) { - pIfTable->table[ndx].dwIndex = table->indexes[ndx]; - GetIfEntry(&pIfTable->table[ndx]); - pIfTable->dwNumEntries++; - } - if (bOrder) - qsort(pIfTable->table, pIfTable->dwNumEntries, sizeof(MIB_IFROW), - IfTableSorter); - ret = NO_ERROR; - } - HeapFree(GetProcessHeap(), 0, table); - } - else - ret = ERROR_OUTOFMEMORY; + table->dwNumEntries = count; + for (i = 0; i < count; i++) + { + MIB_IFROW *row = table->table + i; + + if_row_fill( row, rw + i, dyn + i, stat + i ); } - } - TRACE("returning %d\n", ret); - return ret; + + if (sort) qsort( table->table, count, sizeof(MIB_IFROW), ifrow_cmp ); + +err: + NsiFreeTable( keys, rw, dyn, stat ); + return err; } static void if_counted_string_copy( WCHAR *dst, unsigned int len, IF_COUNTED_STRING *src ) diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 784eafbd1ef..1e8950f3482 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -238,12 +238,16 @@ static void testGetIfTable(void) if (apiReturn == NO_ERROR) { + char descr[MAX_INTERFACE_NAME_LEN]; + WCHAR name[MAX_INTERFACE_NAME_LEN]; DWORD i, index; if (winetest_debug > 1) trace( "interface table: %u entries\n", buf->dwNumEntries ); for (i = 0; i < buf->dwNumEntries; i++) { MIB_IFROW *row = &buf->table[i]; + MIB_IF_ROW2 row2; + GUID *guid; if (winetest_debug > 1) { @@ -261,6 +265,18 @@ static void testGetIfTable(void) ok( index == row->dwIndex || broken( index != row->dwIndex && index ), /* Win8 can have identical guids for two different ifaces */ "got %d vs %d\n", index, row->dwIndex ); + memset( &row2, 0, sizeof(row2) ); + row2.InterfaceIndex = row->dwIndex; + GetIfEntry2( &row2 ); + WideCharToMultiByte( CP_ACP, 0, row2.Description, -1, descr, sizeof(descr), NULL, NULL ); + ok( !strcmp( (char *)row->bDescr, descr ), "got %s vs %s\n", row->bDescr, descr ); + guid = &row2.InterfaceGuid; + swprintf( name, ARRAY_SIZE(name), L"\\DEVICE\\TCPIP_{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", + guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], + guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], + guid->Data4[6], guid->Data4[7]); +todo_wine + ok( !wcscmp( row->wszName, name ), "got %s vs %s\n", debugstr_w( row->wszName ), debugstr_w( name ) ); } } HeapFree(GetProcessHeap(), 0, buf);
1
0
0
0
Huw Davies : iphlpapi: Implement GetAdapterIndex() on top of GetIfTable().
by Alexandre Julliard
09 Jul '21
09 Jul '21
Module: wine Branch: master Commit: bdc48738ce8afed0d72836e48bf2656b3750bc0f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bdc48738ce8afed0d72836e4…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 9 09:09:24 2021 +0100 iphlpapi: Implement GetAdapterIndex() on top of GetIfTable(). Eventually this should just parse the Guid in the name. This is an intermediate step to keep the interface names in sync. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/iphlpapi_main.c | 37 ++++++++++++++++++++++--------------- dlls/iphlpapi/tests/iphlpapi.c | 36 ++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 7c537dc3f27..ff534afa0f9 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -628,28 +628,35 @@ void WINAPI FreeMibTable(void *ptr) * Get interface index from its name. * * PARAMS - * AdapterName [In] unicode string with the adapter name - * IfIndex [Out] returns found interface index + * adapter_name [In] unicode string with the adapter name + * index [Out] returns found interface index * * RETURNS * Success: NO_ERROR * Failure: error code from winerror.h */ -DWORD WINAPI GetAdapterIndex(LPWSTR AdapterName, PULONG IfIndex) +DWORD WINAPI GetAdapterIndex( WCHAR *adapter_name, ULONG *index ) { - char adapterName[MAX_ADAPTER_NAME]; - unsigned int i; - DWORD ret; + MIB_IFTABLE *if_table; + DWORD err, i; - TRACE("(AdapterName %p, IfIndex %p)\n", AdapterName, IfIndex); - /* The adapter name is guaranteed not to have any unicode characters, so - * this translation is never lossy */ - for (i = 0; i < sizeof(adapterName) - 1 && AdapterName[i]; i++) - adapterName[i] = (char)AdapterName[i]; - adapterName[i] = '\0'; - ret = getInterfaceIndexByName(adapterName, IfIndex); - TRACE("returning %d\n", ret); - return ret; + TRACE( "name %s, index %p\n", debugstr_w( adapter_name ), index ); + + err = AllocateAndGetIfTableFromStack( &if_table, 0, GetProcessHeap(), 0 ); + if (err) return err; + + err = ERROR_INVALID_PARAMETER; + for (i = 0; i < if_table->dwNumEntries; i++) + { + if (!strcmpW( adapter_name, if_table->table[i].wszName )) + { + *index = if_table->table[i].dwIndex; + err = ERROR_SUCCESS; + break; + } + } + heap_free( if_table ); + return err; } diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 61406090839..784eafbd1ef 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -236,27 +236,31 @@ static void testGetIfTable(void) "GetIfTable(buf, &dwSize, FALSE) returned %d, expected NO_ERROR\n\n", apiReturn); - if (apiReturn == NO_ERROR && winetest_debug > 1) + if (apiReturn == NO_ERROR) { - DWORD i, j; - char name[MAX_INTERFACE_NAME_LEN]; + DWORD i, index; - trace( "interface table: %u entries\n", buf->dwNumEntries ); + if (winetest_debug > 1) trace( "interface table: %u entries\n", buf->dwNumEntries ); for (i = 0; i < buf->dwNumEntries; i++) { MIB_IFROW *row = &buf->table[i]; - WideCharToMultiByte( CP_ACP, 0, row->wszName, -1, name, MAX_INTERFACE_NAME_LEN, NULL, NULL ); - trace( "%u: '%s' type %u mtu %u speed %u phys", - row->dwIndex, name, row->dwType, row->dwMtu, row->dwSpeed ); - for (j = 0; j < row->dwPhysAddrLen; j++) - printf( " %02x", row->bPhysAddr[j] ); - printf( "\n" ); - trace( " in: bytes %u upkts %u nupkts %u disc %u err %u unk %u\n", - row->dwInOctets, row->dwInUcastPkts, row->dwInNUcastPkts, - row->dwInDiscards, row->dwInErrors, row->dwInUnknownProtos ); - trace( " out: bytes %u upkts %u nupkts %u disc %u err %u\n", - row->dwOutOctets, row->dwOutUcastPkts, row->dwOutNUcastPkts, - row->dwOutDiscards, row->dwOutErrors ); + + if (winetest_debug > 1) + { + trace( "%u: '%s' type %u mtu %u speed %u\n", + row->dwIndex, debugstr_w(row->wszName), row->dwType, row->dwMtu, row->dwSpeed ); + trace( " in: bytes %u upkts %u nupkts %u disc %u err %u unk %u\n", + row->dwInOctets, row->dwInUcastPkts, row->dwInNUcastPkts, + row->dwInDiscards, row->dwInErrors, row->dwInUnknownProtos ); + trace( " out: bytes %u upkts %u nupkts %u disc %u err %u\n", + row->dwOutOctets, row->dwOutUcastPkts, row->dwOutNUcastPkts, + row->dwOutDiscards, row->dwOutErrors ); + } + apiReturn = GetAdapterIndex( row->wszName, &index ); + ok( !apiReturn, "got %d\n", apiReturn ); + ok( index == row->dwIndex || + broken( index != row->dwIndex && index ), /* Win8 can have identical guids for two different ifaces */ + "got %d vs %d\n", index, row->dwIndex ); } } HeapFree(GetProcessHeap(), 0, buf);
1
0
0
0
Huw Davies : iphlpapi: Implement GetInterfaceInfo() on top of GetIfTable().
by Alexandre Julliard
09 Jul '21
09 Jul '21
Module: wine Branch: master Commit: 9f16ac9ae1269e75f79744531864e4819fd997a0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9f16ac9ae1269e75f7974453…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 9 09:09:23 2021 +0100 iphlpapi: Implement GetInterfaceInfo() on top of GetIfTable(). Eventually this should be implemented using NSI. This is an intermediate step to keep the interface names in sync. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/iphlpapi_main.c | 74 ++++++++++++------------------------------ dlls/iphlpapi/tests/iphlpapi.c | 12 ++++++- 2 files changed, 32 insertions(+), 54 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 5621a4485c4..7c537dc3f27 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -2060,65 +2060,33 @@ DWORD WINAPI GetIfTable2( MIB_IF_TABLE2 **table ) * BUGS * MSDN states this should return non-loopback interfaces only. */ -DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen) +DWORD WINAPI GetInterfaceInfo( IP_INTERFACE_INFO *table, ULONG *size ) { - DWORD ret; + MIB_IFTABLE *if_table; + DWORD err, needed, i; - TRACE("pIfTable %p, dwOutBufLen %p\n", pIfTable, dwOutBufLen); - if (!dwOutBufLen) - ret = ERROR_INVALID_PARAMETER; - else { - DWORD numInterfaces = get_interface_indices( FALSE, NULL ); - ULONG size = sizeof(IP_INTERFACE_INFO); + TRACE("table %p, size %p\n", table, size ); + if (!size) return ERROR_INVALID_PARAMETER; - if (numInterfaces > 1) - size += (numInterfaces - 1) * sizeof(IP_ADAPTER_INDEX_MAP); - if (!pIfTable || *dwOutBufLen < size) { - *dwOutBufLen = size; - ret = ERROR_INSUFFICIENT_BUFFER; - } - else { - InterfaceIndexTable *table; - get_interface_indices( FALSE, &table ); + err = AllocateAndGetIfTableFromStack( &if_table, 0, GetProcessHeap(), 0 ); + if (err) return err; - if (table) { - size = sizeof(IP_INTERFACE_INFO); - if (table->numIndexes > 1) - size += (table->numIndexes - 1) * sizeof(IP_ADAPTER_INDEX_MAP); - if (*dwOutBufLen < size) { - *dwOutBufLen = size; - ret = ERROR_INSUFFICIENT_BUFFER; - } - else { - DWORD ndx; - char nameBuf[MAX_ADAPTER_NAME]; + needed = FIELD_OFFSET(IP_INTERFACE_INFO, Adapter[if_table->dwNumEntries]); + if (!table || *size < needed) + { + *size = needed; + heap_free( if_table ); + return ERROR_INSUFFICIENT_BUFFER; + } - *dwOutBufLen = size; - pIfTable->NumAdapters = 0; - for (ndx = 0; ndx < table->numIndexes; ndx++) { - const char *walker, *name; - WCHAR *assigner; - - pIfTable->Adapter[ndx].Index = table->indexes[ndx]; - name = getInterfaceNameByIndex(table->indexes[ndx], nameBuf); - for (walker = name, assigner = pIfTable->Adapter[ndx].Name; - walker && *walker && - assigner - pIfTable->Adapter[ndx].Name < MAX_ADAPTER_NAME - 1; - walker++, assigner++) - *assigner = *walker; - *assigner = 0; - pIfTable->NumAdapters++; - } - ret = NO_ERROR; - } - HeapFree(GetProcessHeap(), 0, table); - } - else - ret = ERROR_OUTOFMEMORY; + table->NumAdapters = if_table->dwNumEntries; + for (i = 0; i < if_table->dwNumEntries; i++) + { + table->Adapter[i].Index = if_table->table[i].dwIndex; + strcpyW( table->Adapter[i].Name, if_table->table[i].wszName ); } - } - TRACE("returning %d\n", ret); - return ret; + heap_free( if_table ); + return ERROR_SUCCESS; } diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 39aa7123668..61406090839 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -1040,7 +1040,7 @@ static void testWinNT4Functions(void) static void testGetInterfaceInfo(void) { DWORD apiReturn; - ULONG len = 0; + ULONG len = 0, i; apiReturn = GetInterfaceInfo(NULL, NULL); if (apiReturn == ERROR_NOT_SUPPORTED) { @@ -1061,6 +1061,16 @@ static void testGetInterfaceInfo(void) ok(apiReturn == NO_ERROR, "GetInterfaceInfo(buf, &dwSize) returned %d, expected NO_ERROR\n", apiReturn); + + for (i = 0; i < buf->NumAdapters; i++) + { + MIB_IFROW row = { .dwIndex = buf->Adapter[i].Index }; + GetIfEntry( &row ); + ok( !wcscmp( buf->Adapter[i].Name, row.wszName ), "got %s vs %s\n", + debugstr_w( buf->Adapter[i].Name ), debugstr_w( row.wszName ) ); +todo_wine_if( row.dwType == IF_TYPE_SOFTWARE_LOOPBACK) + ok( row.dwType != IF_TYPE_SOFTWARE_LOOPBACK, "got loopback\n" ); + } HeapFree(GetProcessHeap(), 0, buf); } }
1
0
0
0
Zebediah Figura : ws2_32: Move the setsockopt(IP_OPTIONS) implementation to ntdll.
by Alexandre Julliard
09 Jul '21
09 Jul '21
Module: wine Branch: master Commit: ecce6909d6b24134b3e7355fe0ab88b3efba2dcd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ecce6909d6b24134b3e7355f…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Jul 8 21:24:49 2021 -0500 ws2_32: Move the setsockopt(IP_OPTIONS) implementation to ntdll. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/socket.c | 3 +++ dlls/ws2_32/socket.c | 4 +++- include/wine/afd.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index b3d0c1575e6..a3e0cb339e6 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1767,6 +1767,9 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc case IOCTL_AFD_WINE_GET_IP_OPTIONS: return do_getsockopt( handle, io, IPPROTO_IP, IP_OPTIONS, out_buffer, out_size ); + case IOCTL_AFD_WINE_SET_IP_OPTIONS: + return do_setsockopt( handle, io, IPPROTO_IP, IP_OPTIONS, in_buffer, in_size ); + default: { if ((code >> 16) == FILE_DEVICE_NETWORK) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 03dc47abc24..9aaef3e595f 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -3663,6 +3663,9 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, case WS_IP_MULTICAST_TTL: return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_MULTICAST_TTL, optval, optlen ); + case WS_IP_OPTIONS: + return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_OPTIONS, optval, optlen ); + case WS_IP_UNBLOCK_SOURCE: { WS_IP_MREQ_SOURCE* val = (void*)optval; @@ -3676,7 +3679,6 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, convert_sockopt(&level, &optname); break; } - case WS_IP_OPTIONS: #if defined(IP_PKTINFO) || defined(IP_RECVDSTADDR) case WS_IP_PKTINFO: #endif diff --git a/include/wine/afd.h b/include/wine/afd.h index 20815f4012d..37969f5fbf6 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -197,6 +197,7 @@ struct afd_get_events_params #define IOCTL_AFD_WINE_GET_IP_MULTICAST_TTL WINE_AFD_IOC(252) #define IOCTL_AFD_WINE_SET_IP_MULTICAST_TTL WINE_AFD_IOC(253) #define IOCTL_AFD_WINE_GET_IP_OPTIONS WINE_AFD_IOC(254) +#define IOCTL_AFD_WINE_SET_IP_OPTIONS WINE_AFD_IOC(255) struct afd_create_params {
1
0
0
0
Zebediah Figura : ws2_32: Move the getsockopt(IP_OPTIONS) implementation to ntdll.
by Alexandre Julliard
09 Jul '21
09 Jul '21
Module: wine Branch: master Commit: eafb3f6108abbbd54730a9bd1f05079fe830e4e8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=eafb3f6108abbbd54730a9bd…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Jul 8 21:24:48 2021 -0500 ws2_32: Move the getsockopt(IP_OPTIONS) implementation to ntdll. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/socket.c | 3 +++ dlls/ws2_32/socket.c | 2 ++ include/wine/afd.h | 1 + 3 files changed, 6 insertions(+) diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index cb41dde28c0..b3d0c1575e6 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1764,6 +1764,9 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc case IOCTL_AFD_WINE_SET_IP_MULTICAST_TTL: return do_setsockopt( handle, io, IPPROTO_IP, IP_MULTICAST_TTL, in_buffer, in_size ); + case IOCTL_AFD_WINE_GET_IP_OPTIONS: + return do_getsockopt( handle, io, IPPROTO_IP, IP_OPTIONS, out_buffer, out_size ); + default: { if ((code >> 16) == FILE_DEVICE_NETWORK) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index d039833ec36..03dc47abc24 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2449,6 +2449,8 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_MULTICAST_TTL, optval, optlen ); case WS_IP_OPTIONS: + return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_OPTIONS, optval, optlen ); + #if defined(IP_PKTINFO) || defined(IP_RECVDSTADDR) case WS_IP_PKTINFO: #endif diff --git a/include/wine/afd.h b/include/wine/afd.h index 6286ef5ca29..20815f4012d 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -196,6 +196,7 @@ struct afd_get_events_params #define IOCTL_AFD_WINE_SET_IP_MULTICAST_LOOP WINE_AFD_IOC(251) #define IOCTL_AFD_WINE_GET_IP_MULTICAST_TTL WINE_AFD_IOC(252) #define IOCTL_AFD_WINE_SET_IP_MULTICAST_TTL WINE_AFD_IOC(253) +#define IOCTL_AFD_WINE_GET_IP_OPTIONS WINE_AFD_IOC(254) struct afd_create_params {
1
0
0
0
Zebediah Figura : ws2_32: Move the setsockopt(IP_MULTICAST_TTL) implementation to ntdll.
by Alexandre Julliard
09 Jul '21
09 Jul '21
Module: wine Branch: master Commit: ffb732bb31052f722ba314b715afd28b23723084 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ffb732bb31052f722ba314b7…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Jul 8 21:24:47 2021 -0500 ws2_32: Move the setsockopt(IP_MULTICAST_TTL) implementation to ntdll. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/socket.c | 3 +++ dlls/ws2_32/socket.c | 4 +++- include/wine/afd.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index 19cbd78028e..cb41dde28c0 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1761,6 +1761,9 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc case IOCTL_AFD_WINE_GET_IP_MULTICAST_TTL: return do_getsockopt( handle, io, IPPROTO_IP, IP_MULTICAST_TTL, out_buffer, out_size ); + case IOCTL_AFD_WINE_SET_IP_MULTICAST_TTL: + return do_setsockopt( handle, io, IPPROTO_IP, IP_MULTICAST_TTL, in_buffer, in_size ); + default: { if ((code >> 16) == FILE_DEVICE_NETWORK) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 688634c7951..d039833ec36 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -3658,6 +3658,9 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, case WS_IP_MULTICAST_LOOP: return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_MULTICAST_LOOP, optval, optlen ); + case WS_IP_MULTICAST_TTL: + return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_MULTICAST_TTL, optval, optlen ); + case WS_IP_UNBLOCK_SOURCE: { WS_IP_MREQ_SOURCE* val = (void*)optval; @@ -3671,7 +3674,6 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, convert_sockopt(&level, &optname); break; } - case WS_IP_MULTICAST_TTL: case WS_IP_OPTIONS: #if defined(IP_PKTINFO) || defined(IP_RECVDSTADDR) case WS_IP_PKTINFO: diff --git a/include/wine/afd.h b/include/wine/afd.h index d650b13e297..6286ef5ca29 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -195,6 +195,7 @@ struct afd_get_events_params #define IOCTL_AFD_WINE_GET_IP_MULTICAST_LOOP WINE_AFD_IOC(250) #define IOCTL_AFD_WINE_SET_IP_MULTICAST_LOOP WINE_AFD_IOC(251) #define IOCTL_AFD_WINE_GET_IP_MULTICAST_TTL WINE_AFD_IOC(252) +#define IOCTL_AFD_WINE_SET_IP_MULTICAST_TTL WINE_AFD_IOC(253) struct afd_create_params {
1
0
0
0
Zebediah Figura : ws2_32: Move the getsockopt(IP_MULTICAST_TTL) implementation to ntdll.
by Alexandre Julliard
09 Jul '21
09 Jul '21
Module: wine Branch: master Commit: e276b99afae446543e0054f1b75eec1a96c67e4d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e276b99afae446543e0054f1…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Jul 8 21:24:46 2021 -0500 ws2_32: Move the getsockopt(IP_MULTICAST_TTL) implementation to ntdll. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/socket.c | 3 +++ dlls/ws2_32/socket.c | 2 ++ include/wine/afd.h | 1 + 3 files changed, 6 insertions(+) diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index f37a8178552..19cbd78028e 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1758,6 +1758,9 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc case IOCTL_AFD_WINE_SET_IP_MULTICAST_LOOP: return do_setsockopt( handle, io, IPPROTO_IP, IP_MULTICAST_LOOP, in_buffer, in_size ); + case IOCTL_AFD_WINE_GET_IP_MULTICAST_TTL: + return do_getsockopt( handle, io, IPPROTO_IP, IP_MULTICAST_TTL, out_buffer, out_size ); + default: { if ((code >> 16) == FILE_DEVICE_NETWORK) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index b8b8ea3480b..688634c7951 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2446,6 +2446,8 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_MULTICAST_LOOP, optval, optlen ); case WS_IP_MULTICAST_TTL: + return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_MULTICAST_TTL, optval, optlen ); + case WS_IP_OPTIONS: #if defined(IP_PKTINFO) || defined(IP_RECVDSTADDR) case WS_IP_PKTINFO: diff --git a/include/wine/afd.h b/include/wine/afd.h index a0e8b0f5fef..d650b13e297 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -194,6 +194,7 @@ struct afd_get_events_params #define IOCTL_AFD_WINE_SET_IP_MULTICAST_IF WINE_AFD_IOC(249) #define IOCTL_AFD_WINE_GET_IP_MULTICAST_LOOP WINE_AFD_IOC(250) #define IOCTL_AFD_WINE_SET_IP_MULTICAST_LOOP WINE_AFD_IOC(251) +#define IOCTL_AFD_WINE_GET_IP_MULTICAST_TTL WINE_AFD_IOC(252) struct afd_create_params {
1
0
0
0
← Newer
1
...
41
42
43
44
45
46
47
...
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