Paul Gofman : hnetcfg: Implement static_ports_get_Count().

Alexandre Julliard julliard at winehq.org
Wed Feb 2 16:38:02 CST 2022


Module: wine
Branch: master
Commit: 7ed9fb0a6876aa6f3ebaf92ec7f519d37a2a7b7a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7ed9fb0a6876aa6f3ebaf92ec7f519d37a2a7b7a

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Wed Feb  2 11:32:56 2022 +0300

hnetcfg: Implement static_ports_get_Count().

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hnetcfg/port.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/hnetcfg/port.c b/dlls/hnetcfg/port.c
index c04aaefe56a..34e054527d9 100644
--- a/dlls/hnetcfg/port.c
+++ b/dlls/hnetcfg/port.c
@@ -735,6 +735,16 @@ static BOOL find_port_mapping( LONG port, BSTR protocol, struct port_mapping *re
     return found;
 }
 
+static unsigned int get_port_mapping_count(void)
+{
+    unsigned int ret;
+
+    AcquireSRWLockExclusive( &upnp_gateway_connection_lock );
+    ret = upnp_gateway_connection.mapping_count;
+    ReleaseSRWLockExclusive( &upnp_gateway_connection_lock );
+    return ret;
+}
+
 static BOOL is_valid_protocol( BSTR protocol )
 {
     if (!protocol) return FALSE;
@@ -1205,10 +1215,11 @@ static HRESULT WINAPI static_ports_get_Count(
     IStaticPortMappingCollection *iface,
     LONG *count )
 {
-    FIXME( "iface %p, count %p stub.\n", iface, count );
+    TRACE( "iface %p, count %p.\n", iface, count );
 
-    if (count) *count = 0;
-    return E_NOTIMPL;
+    if (!count) return E_POINTER;
+    *count = get_port_mapping_count();
+    return S_OK;
 }
 
 static HRESULT WINAPI static_ports_Remove(




More information about the wine-cvs mailing list