[PATCH] netprofm: Initialize ret value in IEnumNetworkConnections_Next().
Jactry Zeng
jzeng at codeweavers.com
Fri Oct 23 04:27:49 CDT 2020
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
Fixes a hang of Futu Securities.
---
dlls/netprofm/list.c | 2 ++
dlls/netprofm/tests/list.c | 20 +++++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/netprofm/list.c b/dlls/netprofm/list.c
index def2aa6cf67..72a594a81d5 100644
--- a/dlls/netprofm/list.c
+++ b/dlls/netprofm/list.c
@@ -1000,6 +1000,8 @@ static HRESULT WINAPI connections_enum_Next(
TRACE( "%p, %u %p %p\n", iter, count, ret, fetched );
+ if (!ret) return E_POINTER;
+ *ret = NULL;
if (fetched) *fetched = 0;
if (!count) return S_OK;
diff --git a/dlls/netprofm/tests/list.c b/dlls/netprofm/tests/list.c
index 0a1f854c00b..87eb857426b 100644
--- a/dlls/netprofm/tests/list.c
+++ b/dlls/netprofm/tests/list.c
@@ -229,7 +229,7 @@ static void test_INetworkListManager( void )
INetworkConnection *conn;
DWORD cookie;
HRESULT hr;
- ULONG ref1, ref2;
+ ULONG ref1, ref2, fetched;
IID iid;
hr = CoCreateInstance( &CLSID_NetworkListManager, NULL, CLSCTX_INPROC_SERVER,
@@ -351,11 +351,29 @@ static void test_INetworkListManager( void )
ok( hr == S_OK, "got %08x\n", hr );
if (conn_iter)
{
+ fetched = 256;
+ hr = IEnumNetworkConnections_Next( conn_iter, 1, NULL, &fetched );
+ ok( hr == E_POINTER, "got hr %#x.\n", hr );
+ ok( fetched == 256, "got wrong feteched: %d.\n", fetched );
+
+ hr = IEnumNetworkConnections_Next( conn_iter, 0, NULL, &fetched );
+ ok( hr == E_POINTER, "got hr %#x.\n", hr );
+ ok( fetched == 256, "got wrong feteched: %d.\n", fetched );
+
while ((hr = IEnumNetworkConnections_Next( conn_iter, 1, &conn, NULL )) == S_OK)
{
test_INetworkConnection( conn );
INetworkConnection_Release( conn );
}
+ ok( !conn, "got wrong pointer: %p.\n", conn );
+
+ conn = (void *)0xdeadbeef;
+ hr = IEnumNetworkConnections_Next( conn_iter, 0, &conn, &fetched );
+ ok( hr == S_OK, "got hr %#x.\n", hr );
+ ok( !conn || broken( conn == (void *)0xdeadbeef ) /* win10 v2004 */,
+ "got wrong pointer: %p.\n", conn );
+ ok( !fetched, "got wrong feteched: %d.\n", fetched );
+
IEnumNetworkConnections_Release( conn_iter );
}
--
2.28.0
More information about the wine-devel
mailing list