+ delay = rand() % (UDP_MAX_DELAY - UDP_MIN_DELAY + 1) + UDP_MIN_DELAY;
Using rand() for this doesn't seem very random, and it could interfere with an application's use of rand().
+ /* Get size of buffer for adapters */ + adapterAddresses = (IP_ADAPTER_ADDRESSES *) HeapAlloc(heap, 0, bufferSize);
Was this comment meant to be earlier?
Sending messages to every adapter in sequence, with a delay for each, doesn't seem right.
+void terminate_networking(IWSDiscoveryPublisherImpl *impl) +{ + impl->publisherStarted = FALSE; + + WSACleanup(); +}
It seems like this will call WSACleanup even when freeing an object that was never used.