--- glib-2.12.11/glib/giowin32.c	2007-03-09 06:01:41.000000000 +0200
+++ giowin32.c	2007-04-01 16:55:37.000000000 +0300
@@ -831,6 +831,12 @@
 	  if (WSAEventSelect (channel->fd, (HANDLE) watch->pollfd.fd,
 			      event_mask) == SOCKET_ERROR)
 	    ;			/* What? */
+	  if (channel->event_mask) {
+	    if (channel->debug)
+	      g_print ("g_io_win32_prepare: SetEvent(%#x)\n",
+	               watch->pollfd.fd);
+	    SetEvent ((HANDLE) watch->pollfd.fd);
+	  }
 	  channel->event_mask = event_mask;
 #if 0
 	  channel->event = watch->pollfd.fd;
@@ -882,7 +888,7 @@
 	}
       else
 	{
-	  WSAEnumNetworkEvents (channel->fd, 0, &events);
+	  WSAEnumNetworkEvents (channel->fd, (HANDLE) watch->pollfd.fd, &events);
 
 	  if (channel->debug)
 	    g_print ("g_io_win32_check: WSAEnumNetworkEvents (%d, %#x) revents={%s} condition={%s} events={%s}\n",
@@ -900,10 +906,13 @@
 		g_print ("g_io_win32_check: WSAEventSelect(%d, %#x, {})\n",
 			 channel->fd, watch->pollfd.fd);
 	      WSAEventSelect (channel->fd, (HANDLE) watch->pollfd.fd, 0);
+	    }
+	  else
+	    {
 	      if (channel->debug)
-		g_print ("g_io_win32_check: ResetEvent(%#x)\n",
+		g_print ("g_io_win32_check: SetEvent(%#x)\n",
 			 watch->pollfd.fd);
-	      ResetEvent ((HANDLE) watch->pollfd.fd);
+	      SetEvent ((HANDLE) watch->pollfd.fd);
 	    }
 	  channel->last_events = events.lNetworkEvents;
 	}
