iphlpapi: Support InitialNotification flag in NotifyUnicastIpAddressChange().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48669
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 5cdd3848f5)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
stable
Paul Gofman 2020-02-27 14:10:32 +03:00 committed by Michael Stefaniuc
parent b4c777d165
commit 3020b07c4b
2 changed files with 46 additions and 1 deletions

View File

@ -2791,9 +2791,13 @@ DWORD WINAPI NotifyRouteChange(PHANDLE Handle, LPOVERLAPPED overlapped)
DWORD WINAPI NotifyUnicastIpAddressChange(ADDRESS_FAMILY family, PUNICAST_IPADDRESS_CHANGE_CALLBACK callback,
PVOID context, BOOLEAN init_notify, PHANDLE handle)
{
FIXME("(family %d, callback %p, context %p, init_notify %d, handle %p): stub\n",
FIXME("(family %d, callback %p, context %p, init_notify %d, handle %p): semi-stub\n",
family, callback, context, init_notify, handle);
if (handle) *handle = NULL;
if (init_notify)
callback(context, NULL, MibInitialNotification);
return ERROR_NOT_SUPPORTED;
}

View File

@ -100,6 +100,9 @@ static DWORD (WINAPI *pConvertInterfaceNameToLuidA)(const char*,NET_LUID*);
static DWORD (WINAPI *pConvertInterfaceNameToLuidW)(const WCHAR*,NET_LUID*);
static DWORD (WINAPI *pConvertLengthToIpv4Mask)(ULONG,ULONG*);
static DWORD (WINAPI *pParseNetworkString)(const WCHAR*,DWORD,NET_ADDRESS_INFO*,USHORT*,BYTE*);
static DWORD (WINAPI *pNotifyUnicastIpAddressChange)(ADDRESS_FAMILY, PUNICAST_IPADDRESS_CHANGE_CALLBACK,
PVOID, BOOLEAN, HANDLE *);
static DWORD (WINAPI *pCancelMibChangeNotify2)(HANDLE);
static PCHAR (WINAPI *pif_indextoname)(NET_IFINDEX,PCHAR);
static NET_IFINDEX (WINAPI *pif_nametoindex)(const char*);
@ -158,6 +161,8 @@ static void loadIPHlpApi(void)
pParseNetworkString = (void *)GetProcAddress(hLibrary, "ParseNetworkString");
pif_indextoname = (void *)GetProcAddress(hLibrary, "if_indextoname");
pif_nametoindex = (void *)GetProcAddress(hLibrary, "if_nametoindex");
pNotifyUnicastIpAddressChange = (void *)GetProcAddress(hLibrary, "NotifyUnicastIpAddressChange");
pCancelMibChangeNotify2 = (void *)GetProcAddress(hLibrary, "CancelMibChangeNotify2");
}
}
@ -2381,6 +2386,41 @@ static void test_ParseNetworkString(void)
}
}
static void WINAPI test_ipaddtess_change_callback(PVOID context, PMIB_UNICASTIPADDRESS_ROW row,
MIB_NOTIFICATION_TYPE notification_type)
{
BOOL *callback_called = context;
*callback_called = TRUE;
ok(notification_type == MibInitialNotification, "Unexpected notification_type %#x.\n",
notification_type);
ok(!row, "Unexpected row %p.\n", row);
}
static void test_NotifyUnicastIpAddressChange(void)
{
BOOL callback_called;
HANDLE handle;
DWORD ret;
if (!pNotifyUnicastIpAddressChange)
{
win_skip("NotifyUnicastIpAddressChange not available.\n");
return;
}
callback_called = FALSE;
ret = pNotifyUnicastIpAddressChange(AF_INET, test_ipaddtess_change_callback,
&callback_called, TRUE, &handle);
todo_wine ok(ret == NO_ERROR, "Unexpected ret %#x.\n", ret);
ok(callback_called, "Callback was not called.\n");
ret = pCancelMibChangeNotify2(handle);
ok(ret == NO_ERROR, "Unexpected ret %#x.\n", ret);
ok(!CloseHandle(handle), "CloseHandle() succeded.\n");
}
START_TEST(iphlpapi)
{
@ -2411,6 +2451,7 @@ START_TEST(iphlpapi)
test_ConvertLengthToIpv4Mask();
test_GetUdp6Table();
test_ParseNetworkString();
test_NotifyUnicastIpAddressChange();
freeIPHlpApi();
}
}