Commit 910d5852 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

iphlpapi: Return ERROR_NO_DATA from GetIpNetTable() if no entries are found.

parent f3978074
...@@ -2326,6 +2326,13 @@ DWORD WINAPI GetIpNetTable( MIB_IPNETTABLE *table, ULONG *size, BOOL sort ) ...@@ -2326,6 +2326,13 @@ DWORD WINAPI GetIpNetTable( MIB_IPNETTABLE *table, ULONG *size, BOOL sort )
} }
table->dwNumEntries = count; table->dwNumEntries = count;
if (!count)
{
err = ERROR_NO_DATA;
goto err;
}
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
MIB_IPNETROW *row = table->table + i; MIB_IPNETROW *row = table->table + i;
......
...@@ -388,11 +388,11 @@ static void testGetIpNetTable(void) ...@@ -388,11 +388,11 @@ static void testGetIpNetTable(void)
else if (apiReturn == ERROR_INSUFFICIENT_BUFFER) { else if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
PMIB_IPNETTABLE buf = HeapAlloc(GetProcessHeap(), 0, dwSize); PMIB_IPNETTABLE buf = HeapAlloc(GetProcessHeap(), 0, dwSize);
memset(buf, 0xcc, dwSize);
apiReturn = GetIpNetTable(buf, &dwSize, FALSE); apiReturn = GetIpNetTable(buf, &dwSize, FALSE);
ok(apiReturn == NO_ERROR || ok((apiReturn == NO_ERROR && buf->dwNumEntries) || (apiReturn == ERROR_NO_DATA && !buf->dwNumEntries),
apiReturn == ERROR_NO_DATA, /* empty ARP table's okay */ "got apiReturn %lu, dwSize %lu, buf->dwNumEntries %lu.\n",
"GetIpNetTable(buf, &dwSize, FALSE) returned %ld, expected NO_ERROR\n", apiReturn, dwSize, buf->dwNumEntries);
apiReturn);
if (apiReturn == NO_ERROR && winetest_debug > 1) if (apiReturn == NO_ERROR && winetest_debug > 1)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment