+#ifdef WIN32
+
+static int send_nfsd_probes(struct rpc_context *rpc, INTERFACE_INFO *InterfaceList, int numIfs, struct nfs_list_data *data)
+{
+ int i=0;
+
+ assert(rpc->magic == RPC_CONTEXT_MAGIC);
+
+ for(i = 0; i < numIfs; i++)
+ {
+ SOCKADDR *pAddress;
+ char bcdd[16];
+ unsigned long nFlags = 0;
+
+ pAddress = (SOCKADDR *) & (InterfaceList[i].iiBroadcastAddress);
+
+ if(pAddress->sa_family != AF_INET)
+ continue;
+
+ nFlags = InterfaceList[i].iiFlags;
+
+ if (!(nFlags & IFF_UP))
+ {
+ continue;
+ }
+
+ if (nFlags & IFF_LOOPBACK)
+ {
+ continue;
+ }
+
+ if (!(nFlags & IFF_BROADCAST))
+ {
+ continue;
+ }
+
+ if (getnameinfo(pAddress, sizeof(struct sockaddr_in), &bcdd[0], sizeof(bcdd), NULL, 0, NI_NUMERICHOST) < 0)
+ {
+ continue;
+ }
+
+ if (rpc_set_udp_destination(rpc, bcdd, 111, 1) < 0)
+ {
+ return -1;
+ }
+
+ if (rpc_pmap_callit_async(rpc, MOUNT_PROGRAM, 2, 0, NULL, 0, callit_cb, data) < 0)
+ {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+struct nfs_server_list *nfs_find_local_servers(void)
+{
+ struct rpc_context *rpc;
+ struct nfs_list_data data = {0, NULL};
+ struct timeval tv_start, tv_current;
+ int loop;
+ struct pollfd pfd;
+ INTERFACE_INFO InterfaceList[20];
+ unsigned long nBytesReturned;
+ int nNumInterfaces = 0;
+
+ rpc = rpc_init_udp_context();
+ if (rpc == NULL)
+ {
+ return NULL;
+ }
+
+ if (rpc_bind_udp(rpc, "0.0.0.0", 0) < 0)
+ {
+ rpc_destroy_context(rpc);
+ return NULL;
+ }
+
+ if (WSAIoctl(rpc_get_fd(rpc), SIO_GET_INTERFACE_LIST, 0, 0, &InterfaceList, sizeof(InterfaceList), &nBytesReturned, 0, 0) == SOCKET_ERROR)
+ {
+ return NULL;
+ }
+
+ nNumInterfaces = nBytesReturned / sizeof(INTERFACE_INFO);
+
+ for (loop=0; loop<3; loop++)
+ {
+ if (send_nfsd_probes(rpc, InterfaceList, nNumInterfaces, &data) != 0)
+ {
+ rpc_destroy_context(rpc);
+ return NULL;
+ }
+
+ win32_gettimeofday(&tv_start, NULL);
+ for(;;)
+ {
+ int mpt;
+
+ pfd.fd = rpc_get_fd(rpc);
+ pfd.events = rpc_which_events(rpc);
+
+ win32_gettimeofday(&tv_current, NULL);
+ mpt = 1000
+ - (tv_current.tv_sec *1000 + tv_current.tv_usec / 1000)
+ + (tv_start.tv_sec *1000 + tv_start.tv_usec / 1000);
+
+ if (poll(&pfd, 1, mpt) < 0)
+ {
+ free_nfs_srvr_list(data.srvrs);
+ rpc_destroy_context(rpc);
+ return NULL;
+ }
+ if (pfd.revents == 0)
+ {
+ break;
+ }
+
+ if (rpc_service(rpc, pfd.revents) < 0)
+ {
+ break;
+ }
+ }
+ }
+
+ rpc_destroy_context(rpc);
+
+ if (data.status != 0)
+ {
+ free_nfs_srvr_list(data.srvrs);
+ return NULL;
+ }
+ return data.srvrs;
+}
+#else
+