call WSASetLastError in NotifyAddrChange/NotifyRouteChange to make following DEMO code working.
void main() { OVERLAPPED overlap; DWORD ret;
HANDLE hand = NULL; overlap.hEvent = WSACreateEvent();
ret = NotifyAddrChange(&hand, &overlap);
if (ret != NO_ERROR) { if (WSAGetLastError() != WSA_IO_PENDING) { printf("NotifyAddrChange error...%d\n", WSAGetLastError()); return; } }
if ( WaitForSingleObject(overlap.hEvent, INFINITE) == WAIT_OBJECT_0 ) printf("IP Address table changed..\n"); }
--- dlls/iphlpapi/iphlpapi_main.c | 57 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 12 deletions(-)