Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- 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 f9b9e2ea312..fa94916dd9b 100644 --- a/dlls/netprofm/list.c +++ b/dlls/netprofm/list.c @@ -1001,6 +1001,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 ff7755162cc..1b168b5565e 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, @@ -355,11 +355,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 ); }