Module: wine Branch: master Commit: d0923a2f729fc8d5e872e7882ef00bcd2ef4032f URL: https://gitlab.winehq.org/wine/wine/-/commit/d0923a2f729fc8d5e872e7882ef00bc...
Author: Sebastián Aedo saedo@codeweavers.com Date: Fri Nov 4 12:39:22 2022 -0300
netprofm: Implement network_GetNetworkConnections.
Signed-off-by: Sebastián Aedo saedo@codeweavers.com
---
dlls/netprofm/list.c | 52 ++++++++++++++++++++++++++++++++++++---------- dlls/netprofm/tests/list.c | 4 ++-- 2 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/dlls/netprofm/list.c b/dlls/netprofm/list.c index e22609dcaf6..db4f13f532e 100644 --- a/dlls/netprofm/list.c +++ b/dlls/netprofm/list.c @@ -94,6 +94,9 @@ struct sink_entry IUnknown *unk; };
+static HRESULT create_connections_enum( + struct list_manager *, IEnumNetworkConnections** ); + static inline struct list_manager *impl_from_IConnectionPointContainer(IConnectionPointContainer *iface) { return CONTAINING_RECORD(iface, struct list_manager, IConnectionPointContainer_iface); @@ -111,6 +114,12 @@ static inline struct connection_point *impl_from_IConnectionPoint( return CONTAINING_RECORD( iface, struct connection_point, IConnectionPoint_iface ); }
+static inline struct list_manager *impl_from_INetworkListManager( + INetworkListManager *iface ) +{ + return CONTAINING_RECORD( iface, struct list_manager, INetworkListManager_iface ); +} + static HRESULT WINAPI connection_point_QueryInterface( IConnectionPoint *iface, REFIID riid, @@ -432,12 +441,42 @@ static HRESULT WINAPI network_GetDomainType( return S_OK; }
+static ULONG WINAPI connection_Release( + INetworkConnection *iface ); + static HRESULT WINAPI network_GetNetworkConnections( INetwork *iface, IEnumNetworkConnections **ppEnumNetworkConnection ) { - FIXME( "%p, %p\n", iface, ppEnumNetworkConnection ); - return E_NOTIMPL; + HRESULT hr; + INetworkListManager *network_list_mgr = NULL; + struct list_manager *mgr = NULL; + struct network *current_network = impl_from_INetwork( iface ); + + struct connection *connection, *next; + struct network *network; + + if (FAILED(hr = list_manager_create((void**)&network_list_mgr))) + return hr; + + mgr = impl_from_INetworkListManager(network_list_mgr); + + if (FAILED(hr = create_connections_enum(mgr, ppEnumNetworkConnection))) + return hr; + + TRACE("%p, %s\n", iface, debugstr_guid(¤t_network->id)); + + LIST_FOR_EACH_ENTRY_SAFE(connection, next, &mgr->connections, struct connection, entry) + { + network = impl_from_INetwork(connection->network); + if (!IsEqualGUID(&network->id, ¤t_network->id)) + { + TRACE("Filtering %s\n", debugstr_guid(&network->id)); + list_remove(&connection->entry); + } + } + + return S_OK; }
static HRESULT WINAPI network_GetTimeCreatedAndConnected( @@ -881,12 +920,6 @@ static HRESULT create_networks_enum( return S_OK; }
-static inline struct list_manager *impl_from_INetworkListManager( - INetworkListManager *iface ) -{ - return CONTAINING_RECORD( iface, struct list_manager, INetworkListManager_iface ); -} - struct connections_enum { IEnumNetworkConnections IEnumNetworkConnections_iface; @@ -1057,9 +1090,6 @@ static HRESULT WINAPI connections_enum_Reset( return S_OK; }
-static HRESULT create_connections_enum( - struct list_manager *, IEnumNetworkConnections** ); - static HRESULT WINAPI connections_enum_Clone( IEnumNetworkConnections *iface, IEnumNetworkConnections **ret ) { diff --git a/dlls/netprofm/tests/list.c b/dlls/netprofm/tests/list.c index 6f46c125763..b58aef9bdec 100644 --- a/dlls/netprofm/tests/list.c +++ b/dlls/netprofm/tests/list.c @@ -98,7 +98,7 @@ static void test_INetwork( INetwork *network, INetworkConnection *conn )
conn_iter = NULL; hr = INetwork_GetNetworkConnections( network, &conn_iter ); - todo_wine ok( hr == S_OK, "got %08lx\n", hr ); + ok( hr == S_OK, "got %08lx\n", hr );
is_connection_present = FALSE; if (conn_iter) @@ -120,7 +120,7 @@ static void test_INetwork( INetwork *network, INetworkConnection *conn ) IEnumNetworkConnections_Release( conn_iter ); }
- todo_wine ok( is_connection_present, "connection was not present in network\n" ); + ok( is_connection_present, "connection was not present in network\n" ); }
static void test_INetworkConnection( INetworkConnection *conn )