diff -urN libevent-0.6/WIN32-Code/config.h libevent-0.6-win32/WIN32-Code/config.h
--- libevent-0.6/WIN32-Code/config.h	Wed Dec 31 18:00:00 1969
+++ libevent-0.6-win32/WIN32-Code/config.h	Fri Mar 14 18:28:32 2003
@@ -0,0 +1,131 @@
+/* config.h.  Generated by configure.  */
+/* config.h.in.  Generated from configure.in by autoheader.  */
+/* Define if kqueue works correctly with pipes */
+/* #undef HAVE_WORKING_KQUEUE */
+
+/* Define to `unsigned long long' if <sys/types.h> doesn't define.  */
+/* #undef u_int64_t */
+
+/* Define to `unsigned int' if <sys/types.h> doesn't define.  */
+/* #undef u_int32_t */
+
+/* Define to `unsigned short' if <sys/types.h> doesn't define.  */
+/* #undef u_int16_t */
+
+/* Define to `unsigned char' if <sys/types.h> doesn't define.  */
+/* #undef u_int8_t */
+
+/* Define if timeradd is defined in <sys/time.h> */
+#define HAVE_TIMERADD 1
+#ifndef HAVE_TIMERADD
+#define timeradd(tvp, uvp, vvp)           \
+  do {                \
+    (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;    \
+    (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;       \
+    if ((vvp)->tv_usec >= 1000000) {      \
+      (vvp)->tv_sec++;        \
+      (vvp)->tv_usec -= 1000000;      \
+    }             \
+  } while (0)
+#define timersub(tvp, uvp, vvp)           \
+  do {                \
+    (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;    \
+    (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
+    if ((vvp)->tv_usec < 0) {       \
+      (vvp)->tv_sec--;        \
+      (vvp)->tv_usec += 1000000;      \
+    }             \
+  } while (0)
+#endif /* !HAVE_TIMERADD */
+
+/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
+#define HAVE_TAILQFOREACH 1
+#ifndef HAVE_TAILQFOREACH
+#define TAILQ_FIRST(head)   ((head)->tqh_first)
+#define TAILQ_END(head)     NULL
+#define TAILQ_NEXT(elm, field)    ((elm)->field.tqe_next)
+#define TAILQ_FOREACH(var, head, field)         \
+  for((var) = TAILQ_FIRST(head);          \
+      (var) != TAILQ_END(head);         \
+      (var) = TAILQ_NEXT(var, field))
+#define TAILQ_INSERT_BEFORE(listelm, elm, field) do {     \
+  (elm)->field.tqe_prev = (listelm)->field.tqe_prev;    \
+  (elm)->field.tqe_next = (listelm);        \
+  *(listelm)->field.tqe_prev = (elm);       \
+  (listelm)->field.tqe_prev = &(elm)->field.tqe_next;   \
+} while (0)
+#endif /* TAILQ_FOREACH */
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `kqueue' function. */
+/* #undef HAVE_KQUEUE */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `select' function. */
+/* #undef HAVE_SELECT */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+#define HAVE_SYS_EVENT_H 1
+
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#define HAVE_SYS_QUEUE_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `warnx' function. */
+#define HAVE_WARNX 1
+
+/* Name of package */
+#define PACKAGE "libevent"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "0.6"
diff -urN libevent-0.6/WIN32-Code/misc.c libevent-0.6-win32/WIN32-Code/misc.c
--- libevent-0.6/WIN32-Code/misc.c	Wed Dec 31 18:00:00 1969
+++ libevent-0.6-win32/WIN32-Code/misc.c	Fri Mar 14 18:28:32 2003
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <string.h>
+#include <windows.h>
+#include <sys/timeb.h>
+#include <time.h>
+
+/****************************************************************************
+ *
+ * Function: gettimeofday(struct timeval *, struct timezone *)
+ *
+ * Purpose:  Get current time of day.
+ *
+ * Arguments: tv => Place to store the curent time of day.
+ *            tz => Ignored.
+ *
+ * Returns: 0 => Success.
+ *
+ ****************************************************************************/
+
+int gettimeofday(struct timeval *tv, struct timezone *tz) {
+  struct _timeb tb;
+
+	if(tv == NULL)
+		return -1;
+
+	_ftime(&tb);
+	tv->tv_sec = tb.time;
+	tv->tv_usec = ((int) tb.millitm) * 1000;
+	return 0;
+}
diff -urN libevent-0.6/WIN32-Code/misc.h libevent-0.6-win32/WIN32-Code/misc.h
--- libevent-0.6/WIN32-Code/misc.h	Wed Dec 31 18:00:00 1969
+++ libevent-0.6-win32/WIN32-Code/misc.h	Fri Mar 14 18:28:32 2003
@@ -0,0 +1,6 @@
+#ifndef MISC_H
+#define MISC_H
+
+int gettimeofday(struct timeval *,struct timezone *);
+
+#endif
diff -urN libevent-0.6/WIN32-Code/win32.c libevent-0.6-win32/WIN32-Code/win32.c
--- libevent-0.6/WIN32-Code/win32.c	Wed Dec 31 18:00:00 1969
+++ libevent-0.6-win32/WIN32-Code/win32.c	Fri Mar 14 18:28:32 2003
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2003 Michael A. Davis <mike@datanerds.net>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Michael A. Davis.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "config.h"
+
+#include <windows.h>
+#include <sys/types.h>
+#include <sys/queue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <err.h>
+
+#ifdef USE_LOG
+#include "log.h"
+#else
+#define LOG_DBG(x)
+#define log_error(x)	perror(x)
+#endif
+
+#include "event.h"
+
+extern struct event_list timequeue;
+extern struct event_list eventqueue;
+extern struct event_list addqueue;
+extern struct event_list signalqueue;
+
+#define NEVENT		64
+
+int evsigcaught[NSIG];
+volatile sig_atomic_t signal_caught = 0;
+/* MSDN says this is required to handle SIGFPE */
+volatile double SIGFPE_REQ = 0.0f; 
+
+int signal_handler(int sig);
+void signal_process(void);
+int signal_recalc(void);
+
+void *win32_init	(void);
+int win32_insert	(void *, struct event *);
+int win32_del	(void *, struct event *);
+int win32_recalc	(void *, int);
+int win32_dispatch	(void *, struct timeval *);
+
+struct eventop win32ops = {
+	"win32",
+	win32_init,
+	win32_insert,
+	win32_del,
+	win32_recalc,
+	win32_dispatch
+};
+
+static int timeval_to_ms(struct timeval *tv)
+{
+	return ((tv->tv_sec * 1000) + (tv->tv_usec / 1000));
+}
+
+void *
+win32_init(void)
+{
+	return (NULL);
+}
+
+int
+win32_recalc(void *arg, int max)
+{
+	return (signal_recalc());
+}
+
+int
+win32_insert(struct win32op *wop, struct event *ev)
+{
+	if (ev->ev_events & EV_SIGNAL) {
+		if (ev->ev_events & (EV_READ|EV_WRITE))
+			errx(1, "%s: EV_SIGNAL incompatible use",
+			    __FUNCTION__);
+		if((int)signal(EVENT_SIGNAL(ev), signal_handler) == -1)
+			return (-1);
+
+		return (0);
+	}
+
+	return (0);
+}
+
+int
+win32_dispatch(void *arg, struct timeval *tv)
+{
+	int res = 0;
+	struct win32op *wop = arg;
+	struct event *ev;
+	int evres;
+
+	TAILQ_FOREACH(ev, &eventqueue, ev_next) {
+		res = WaitForSingleObject(ev->ev_fd, timeval_to_ms(tv));
+
+		if(res == WAIT_TIMEOUT || res == WAIT_FAILED) {
+			signal_process();
+			return (0);
+		} else if (signal_caught)
+			signal_process();
+
+		evres = 0;
+		if(ev->ev_events & EV_READ)
+			evres |= EV_READ;
+
+		if(ev->ev_events & EV_WRITE)
+			evres |= EV_WRITE;
+		if(evres) {
+			if(!(ev->ev_events & EV_PERSIST))
+				event_del(ev);
+			event_active(ev, evres, 1);
+		}
+	}
+
+	if (signal_recalc() == -1)
+		return (-1);
+
+	return (0);
+}
+
+int
+win32_del(struct win32op *arg, struct event *ev)
+{
+	return ((int)signal(EVENT_SIGNAL(ev), SIG_IGN));
+}
+
+static int signal_handler(int sig)
+{
+	evsigcaught[sig]++;
+	signal_caught = 1;
+
+	return 0;
+}
+
+int
+signal_recalc(void)
+{
+	struct event *ev;
+
+	/* Reinstall our signal handler. */
+	TAILQ_FOREACH(ev, &signalqueue, ev_signal_next) {
+		if((int)signal(EVENT_SIGNAL(ev), signal_handler) == -1)
+			return (-1);
+	}
+	return (0);
+}
+
+void
+signal_process(void)
+{
+	struct event *ev;
+	short ncalls;
+
+	TAILQ_FOREACH(ev, &signalqueue, ev_signal_next) {
+		ncalls = evsigcaught[EVENT_SIGNAL(ev)];
+		if (ncalls) {
+			if (!(ev->ev_events & EV_PERSIST))
+				event_del(ev);
+			event_active(ev, EV_SIGNAL, ncalls);
+		}
+	}
+
+	memset(evsigcaught, 0, sizeof(evsigcaught));
+	signal_caught = 0;
+}
Binary files libevent-0.6/WIN32-Prj/Debug/libevent.lib and libevent-0.6-win32/WIN32-Prj/Debug/libevent.lib differ
Binary files libevent-0.6/WIN32-Prj/Release/libevent.lib and libevent-0.6-win32/WIN32-Prj/Release/libevent.lib differ
diff -urN libevent-0.6/WIN32-Prj/event_test/event_test.dsp libevent-0.6-win32/WIN32-Prj/event_test/event_test.dsp
--- libevent-0.6/WIN32-Prj/event_test/event_test.dsp	Wed Dec 31 18:00:00 1969
+++ libevent-0.6-win32/WIN32-Prj/event_test/event_test.dsp	Mon Jan 27 23:10:42 2003
@@ -0,0 +1,100 @@
+# Microsoft Developer Studio Project File - Name="event_test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=event_test - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "event_test.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "event_test.mak" CFG="event_test - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "event_test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "event_test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "event_test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\\" /I "..\..\WIN32-Code" /I "..\..\compat" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF  "$(CFG)" == "event_test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\WIN32-Code" /I "..\..\compat" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "event_test - Win32 Release"
+# Name "event_test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE="..\..\sample\event-test.c"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff -urN libevent-0.6/WIN32-Prj/event_test/test.txt libevent-0.6-win32/WIN32-Prj/event_test/test.txt
--- libevent-0.6/WIN32-Prj/event_test/test.txt	Wed Dec 31 18:00:00 1969
+++ libevent-0.6-win32/WIN32-Prj/event_test/test.txt	Mon Jan 27 22:00:18 2003
@@ -0,0 +1,180 @@
+  
+  Platform SDK: File Storage 
+ReadFile
+The ReadFile function reads data from a file, starting at the position indicated by the file pointer. After the read operation has been completed, the file pointer is adjusted by the number of bytes actually read, unless the file handle is created with the overlapped attribute. If the file handle is created for overlapped input and output (I/O), the application must adjust the position of the file pointer after the read operation. 
+
+This function is designed for both synchronous and asynchronous operation. The ReadFileEx function is designed solely for asynchronous operation. It lets an application perform other processing during a file read operation.
+
+BOOL ReadFile(
+  HANDLE hFile,                // handle to file
+  LPVOID lpBuffer,             // data buffer
+  DWORD nNumberOfBytesToRead,  // number of bytes to read
+  LPDWORD lpNumberOfBytesRead, // number of bytes read
+  LPOVERLAPPED lpOverlapped    // overlapped buffer
+);
+Parameters
+hFile 
+[in] Handle to the file to be read. The file handle must have been created with GENERIC_READ access to the file. 
+Windows NT/2000/XP: For asynchronous read operations, hFile can be any handle opened with the FILE_FLAG_OVERLAPPED flag by the CreateFile function, or a socket handle returned by the socket or accept function. 
+
+Windows 95/98/Me: For asynchronous read operations, hFile can be a communications resource opened with the FILE_FLAG_OVERLAPPED flag by CreateFile, or a socket handle returned by socket or accept. You cannot perform asynchronous read operations on mailslots, named pipes, or disk files. 
+
+lpBuffer 
+[out] Pointer to the buffer that receives the data read from the file. 
+nNumberOfBytesToRead 
+[in] Specifies the number of bytes to be read from the file. 
+lpNumberOfBytesRead 
+[out] Pointer to the variable that receives the number of bytes read. ReadFile sets this value to zero before doing any work or error checking. If this parameter is zero when ReadFile returns TRUE on a named pipe, the other end of the message-mode pipe called the WriteFile function with nNumberOfBytesToWrite set to zero. 
+Windows NT/2000/XP: If lpOverlapped is NULL, lpNumberOfBytesRead cannot be NULL. If lpOverlapped is not NULL, lpNumberOfBytesRead can be NULL. If this is an overlapped read operation, you can get the number of bytes read by calling GetOverlappedResult. If hFile is associated with an I/O completion port, you can get the number of bytes read by calling GetQueuedCompletionStatus. 
+
+If I/O completion ports are used and you are using a callback routine to free the memory allocated to the OVERLAPPED structure pointed to by the lpOverlapped parameter, specify NULL as the value of this parameter to avoid a memory corruption problem during the deallocation. This memory corruption problem will cause an invalid number of bytes to be returned in this parameter. 
+
+Windows 95/98/Me: This parameter cannot be NULL. 
+
+lpOverlapped 
+[in] Pointer to an OVERLAPPED structure. This structure is required if hFile was created with FILE_FLAG_OVERLAPPED. 
+If hFile was opened with FILE_FLAG_OVERLAPPED, the lpOverlapped parameter must not be NULL. It must point to a valid OVERLAPPED structure. If hFile was created with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the function can incorrectly report that the read operation is complete. 
+
+If hFile was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the read operation starts at the offset specified in the OVERLAPPED structure and ReadFile may return before the read operation has been completed. In this case, ReadFile returns FALSE and the GetLastError function returns ERROR_IO_PENDING. This allows the calling process to continue while the read operation finishes. The event specified in the OVERLAPPED structure is set to the signaled state upon completion of the read operation. 
+
+If hFile was not opened with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the read operation starts at the current file position and ReadFile does not return until the operation has been completed. 
+
+Windows NT/2000/XP: If hFile is not opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the read operation starts at the offset specified in the OVERLAPPED structure. ReadFile does not return until the read operation has been completed. 
+
+Windows 95/98/Me: For operations on files, disks, pipes, or mailslots, this parameter must be NULL; a pointer to an OVERLAPPED structure causes the call to fail. However, Windows 95/98/Me supports overlapped I/O on serial and parallel ports. 
+
+Return Values
+The ReadFile function returns when one of the following is true: a write operation completes on the write end of the pipe, the number of bytes requested has been read, or an error occurs. 
+
+If the function succeeds, the return value is nonzero. 
+
+If the return value is nonzero and the number of bytes read is zero, the file pointer was beyond the current end of the file at the time of the read operation. However, if the file was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the return value is FALSE and GetLastError returns ERROR_HANDLE_EOF when the file pointer goes beyond the current end of file.
+
+If the function fails, the return value is zero. To get extended error information, call GetLastError. 
+
+Remarks
+If part of the file is locked by another process and the read operation overlaps the locked portion, this function fails. 
+
+An application must meet certain requirements when working with files opened with FILE_FLAG_NO_BUFFERING: 
+
+File access must begin at byte offsets within the file that are integer multiples of the volume's sector size. To determine a volume's sector size, call the GetDiskFreeSpace function. 
+File access must be for numbers of bytes that are integer multiples of the volume's sector size. For example, if the sector size is 512 bytes, an application can request reads and writes of 512, 1024, or 2048 bytes, but not of 335, 981, or 7171 bytes. 
+Buffer addresses for read and write operations must be sector aligned (aligned on addresses in memory that are integer multiples of the volume's sector size). One way to sector align buffers is to use the VirtualAlloc function to allocate the buffers. This function allocates memory that is aligned on addresses that are integer multiples of the system's page size. Because both page and volume sector sizes are powers of 2, memory aligned by multiples of the system's page size is also aligned by multiples of the volume's sector size. 
+Accessing the input buffer while a read operation is using the buffer may lead to corruption of the data read into that buffer. Applications must not read from, write to, reallocate, or free the input buffer that a read operation is using until the read operation completes.
+
+Characters can be read from the console input buffer by using ReadFile with a handle to console input. The console mode determines the exact behavior of the ReadFile function. 
+
+If a named pipe is being read in message mode and the next message is longer than the nNumberOfBytesToRead parameter specifies, ReadFile returns FALSE and GetLastError returns ERROR_MORE_DATA. The remainder of the message may be read by a subsequent call to the ReadFile or PeekNamedPipe function. 
+
+When reading from a communications device, the behavior of ReadFile is governed by the current communication time-outs as set and retrieved using the SetCommTimeouts and GetCommTimeouts functions. Unpredictable results can occur if you fail to set the time-out values. For more information about communication time-outs, see COMMTIMEOUTS.
+
+If ReadFile attempts to read from a mailslot whose buffer is too small, the function returns FALSE and GetLastError returns ERROR_INSUFFICIENT_BUFFER. 
+
+If the anonymous write pipe handle has been closed and ReadFile attempts to read using the corresponding anonymous read pipe handle, the function returns FALSE and GetLastError returns ERROR_BROKEN_PIPE. 
+
+The ReadFile function may fail and return ERROR_INVALID_USER_BUFFER or ERROR_NOT_ENOUGH_MEMORY whenever there are too many outstanding asynchronous I/O requests. 
+
+The ReadFile code to check for the end-of-file condition (eof) differs for synchronous and asynchronous read operations.
+
+When a synchronous read operation reaches the end of a file, ReadFile returns TRUE and sets *lpNumberOfBytesRead to zero. The following sample code tests for end-of-file for a synchronous read operation:
+
+// Attempt a synchronous read operation. 
+bResult = ReadFile(hFile, &inBuffer, nBytesToRead, &nBytesRead, NULL) ; 
+// Check for end of file. 
+if (bResult &&  nBytesRead == 0, ) 
+{ 
+    // we're at the end of the file 
+} 
+An asynchronous read operation can encounter the end of a file during the initiating call to ReadFile, or during subsequent asynchronous operation. 
+
+If EOF is detected at ReadFile time for an asynchronous read operation, ReadFile returns FALSE and GetLastError returns ERROR_HANDLE_EOF.
+
+If EOF is detected during subsequent asynchronous operation, the call to GetOverlappedResult to obtain the results of that operation returns FALSE and GetLastError returns ERROR_HANDLE_EOF.
+
+To cancel all pending asynchronous I/O operations, use the CancelIo function. This function only cancels operations issued by the calling thread for the specified file handle. I/O operations that are canceled complete with the error ERROR_OPERATION_ABORTED. 
+
+If you are attempting to read from a floppy drive that does not have a floppy disk, the system displays a message box prompting the user to retry the operation. To prevent the system from displaying this message box, call the SetErrorMode function with SEM_NOOPENFILEERRORBOX. 
+
+The following sample code illustrates testing for end-of-file for an asynchronous read operation:
+
+// set up overlapped structure fields 
+gOverLapped.Offset     = 0; 
+gOverLapped.OffsetHigh = 0; 
+gOverLapped.hEvent     = hEvent; 
+ 
+// attempt an asynchronous read operation 
+bResult = ReadFile(hFile, &inBuffer, nBytesToRead, &nBytesRead, 
+    &gOverlapped) ; 
+ 
+// if there was a problem, or the async. operation's still pending ... 
+if (!bResult) 
+{ 
+    // deal with the error code 
+    switch (dwError = GetLastError()) 
+    { 
+        case ERROR_HANDLE_EOF: 
+        { 
+            // we have reached the end of the file 
+            // during the call to ReadFile 
+ 
+            // code to handle that 
+        } 
+ 
+        case ERROR_IO_PENDING: 
+        { 
+            // asynchronous i/o is still in progress 
+ 
+            // do something else for a while 
+            GoDoSomethingElse() ; 
+ 
+            // check on the results of the asynchronous read 
+            bResult = GetOverlappedResult(hFile, &gOverlapped, 
+                &nBytesRead, FALSE) ; 
+ 
+            // if there was a problem ... 
+            if (!bResult) 
+            { 
+                // deal with the error code 
+                switch (dwError = GetLastError()) 
+                { 
+                    case ERROR_HANDLE_EOF: 
+                    { 
+                        // we have reached the end of
+                        // the file during asynchronous
+                        // operation
+                    } 
+ 
+                    // deal with other error cases 
+                } 
+            } 
+        } // end case 
+ 
+        // deal with other error cases 
+ 
+    } // end switch 
+} // end if 
+Example Code
+For an example, see Reading, Writing, and Locking Files. 
+
+Requirements 
+  Windows NT/2000/XP: Included in Windows NT 3.1 and later.
+  Windows 95/98/Me: Included in Windows 95 and later.
+  Header: Declared in Winbase.h; include Windows.h.
+  Library: Use Kernel32.lib.
+
+See Also
+File I/O Overview, File I/O Functions, CancelIo, CreateFile, GetCommTimeouts, GetOverlappedResult, GetQueuedCompletionStatus, OVERLAPPED, PeekNamedPipe, ReadFileEx, SetCommTimeouts, SetErrorMode, WriteFile 
+
+Platform SDK Release: November 2001  What did you think of this topic?
+Let us know.  Order a Platform SDK CD Online
+(U.S/Canada)   (International) 
+
+ 
+
+Requirements 
+  Windows NT/2000/XP: Included in Windows NT 3.1 and later.
+  Windows 95/98/Me: Included in Windows 95 and later.
+  Header: Declared in Winbase.h; include Windows.h.
+  Library: Use Kernel32.lib.
+See Also
+File I/O Overview, File I/O Functions, CancelIo, CreateFile, GetCommTimeouts, GetOverlappedResult, GetQueuedCompletionStatus, OVERLAPPED, PeekNamedPipe, ReadFileEx, SetCommTimeouts, SetErrorMode, WriteFile 
diff -urN libevent-0.6/WIN32-Prj/libevent.dsp libevent-0.6-win32/WIN32-Prj/libevent.dsp
--- libevent-0.6/WIN32-Prj/libevent.dsp	Wed Dec 31 18:00:00 1969
+++ libevent-0.6-win32/WIN32-Prj/libevent.dsp	Mon Jan 27 23:10:42 2003
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="libevent" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libevent - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libevent.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libevent.mak" CFG="libevent - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libevent - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libevent - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libevent - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\\" /I "..\WIN32-Code" /I "..\compat" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "libevent - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\\" /I "..\WIN32-Code" /I "..\compat" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libevent - Win32 Release"
+# Name "libevent - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\err.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\event.c
+# End Source File
+# Begin Source File
+
+SOURCE="..\WIN32-Code\misc.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\WIN32-Code\win32.c"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\acconfig.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\WIN32-Code\config.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\compat\err.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\event.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\WIN32-Code\misc.h"
+# End Source File
+# End Group
+# End Target
+# End Project
diff -urN libevent-0.6/WIN32-Prj/libevent.dsw libevent-0.6-win32/WIN32-Prj/libevent.dsw
--- libevent-0.6/WIN32-Prj/libevent.dsw	Wed Dec 31 18:00:00 1969
+++ libevent-0.6-win32/WIN32-Prj/libevent.dsw	Sat Jan 25 17:35:22 2003
@@ -0,0 +1,74 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "event_test"=".\event_test\event_test.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libevent
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "libevent"=".\libevent.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "signal_test"=".\signal_test\signal_test.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libevent
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "time_test"=".\time_test\time_test.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libevent
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff -urN libevent-0.6/WIN32-Prj/signal_test/signal_test.dsp libevent-0.6-win32/WIN32-Prj/signal_test/signal_test.dsp
--- libevent-0.6/WIN32-Prj/signal_test/signal_test.dsp	Wed Dec 31 18:00:00 1969
+++ libevent-0.6-win32/WIN32-Prj/signal_test/signal_test.dsp	Sat Jan 25 17:35:22 2003
@@ -0,0 +1,100 @@
+# Microsoft Developer Studio Project File - Name="signal_test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=signal_test - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "signal_test.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "signal_test.mak" CFG="signal_test - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "signal_test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "signal_test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "signal_test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF  "$(CFG)" == "signal_test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\WIN32-Code" /I "..\..\compat" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "signal_test - Win32 Release"
+# Name "signal_test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE="..\..\sample\signal-test.c"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff -urN libevent-0.6/WIN32-Prj/time_test/time_test.dsp libevent-0.6-win32/WIN32-Prj/time_test/time_test.dsp
--- libevent-0.6/WIN32-Prj/time_test/time_test.dsp	Wed Dec 31 18:00:00 1969
+++ libevent-0.6-win32/WIN32-Prj/time_test/time_test.dsp	Sat Jan 25 10:16:04 2003
@@ -0,0 +1,100 @@
+# Microsoft Developer Studio Project File - Name="time_test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=time_test - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "time_test.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "time_test.mak" CFG="time_test - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "time_test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "time_test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "time_test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF  "$(CFG)" == "time_test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\WIN32-Code" /I "..\..\compat" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "time_test - Win32 Release"
+# Name "time_test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE="..\..\sample\time-test.c"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff -urN libevent-0.6/compat/sys/queue.h libevent-0.6-win32/compat/sys/queue.h
--- libevent-0.6/compat/sys/queue.h	Tue Apr  9 11:35:06 2002
+++ libevent-0.6-win32/compat/sys/queue.h	Fri Mar 14 18:30:02 2003
@@ -96,12 +96,14 @@
  
 #define	SLIST_HEAD_INITIALIZER(head)					\
 	{ NULL }
- 
+
+#ifndef WIN32
 #define SLIST_ENTRY(type)						\
 struct {								\
 	struct type *sle_next;	/* next element */			\
 }
- 
+#endif
+
 /*
  * Singly-linked List access methods.
  */
diff -urN libevent-0.6/event.c libevent-0.6-win32/event.c
--- libevent-0.6/event.c	Fri Jul 26 09:45:50 2002
+++ libevent-0.6-win32/event.c	Fri Mar 14 18:26:30 2003
@@ -31,13 +31,20 @@
  */
 #include "config.h"
 
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#include "misc.h"
+#else
+#include <unistd.h>
+#endif
 #include <sys/types.h>
 #include <sys/tree.h>
 #include <sys/time.h>
 #include <sys/queue.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 #include <err.h>
@@ -58,6 +65,9 @@
 #ifdef HAVE_WORKING_KQUEUE
 extern struct eventop kqops;
 #endif
+#ifdef WIN32
+extern struct eventop win32ops;
+#endif
 
 /* In order of preference */
 struct eventop *eventops[] = {
@@ -67,6 +77,9 @@
 #ifdef HAVE_SELECT
 	&selectops,
 #endif
+#ifdef WIN32
+	&win32ops,
+#endif
 	NULL
 };
 
@@ -152,7 +165,7 @@
 		while (ncalls) {
 			ncalls--;
 			ev->ev_ncalls = ncalls;
-			(*ev->ev_callback)(ev->ev_fd, ev->ev_res, ev->ev_arg);
+			(*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg);
 		}
 	}
 }
@@ -235,7 +248,12 @@
 {
 	ev->ev_callback = callback;
 	ev->ev_arg = arg;
+#ifdef WIN32
+	ev->ev_fd = (HANDLE)fd;
+	ev->overlap.hEvent = ev;
+#else
 	ev->ev_fd = fd;
+#endif
 	ev->ev_events = events;
 	ev->ev_flags = EVLIST_INIT;
 	ev->ev_ncalls = 0;
diff -urN libevent-0.6/event.h libevent-0.6-win32/event.h
--- libevent-0.6/event.h	Fri Sep  6 12:13:08 2002
+++ libevent-0.6-win32/event.h	Fri Mar 14 18:26:30 2003
@@ -36,6 +36,13 @@
 extern "C" {
 #endif
 
+#ifdef WIN32
+#include <windows.h>
+#ifndef __FUNCTION__
+#define __FUNCTION__ "libevent-win32"
+#endif
+#endif
+
 #define EVLIST_TIMEOUT	0x01
 #define EVLIST_INSERTED	0x02
 #define EVLIST_SIGNAL	0x04
@@ -77,7 +84,12 @@
 	TAILQ_ENTRY (event) ev_signal_next;
 	RB_ENTRY (event) ev_timeout_node;
 
+#ifdef WIN32
+	HANDLE ev_fd;
+	OVERLAPPED overlap;
+#else
 	int ev_fd;
+#endif
 	short ev_events;
 	short ev_ncalls;
 	short *ev_pncalls;	/* Allows deletes in callback */
@@ -91,7 +103,11 @@
 	int ev_flags;
 };
 
+#ifdef WIN32
+#define EVENT_SIGNAL(ev)	(int)ev->ev_fd
+#else
 #define EVENT_SIGNAL(ev)	ev->ev_fd
+#endif
 #define EVENT_FD(ev)		ev->ev_fd
 
 #ifdef _EVENT_DEFINED_TQENTRY
@@ -153,7 +169,11 @@
 
 int event_pending(struct event *, short, struct timeval *);
 
+#ifdef WIN32
+#define event_initialized(ev)		((ev)->ev_flags & EVLIST_INIT && (ev)->ev_fd != INVALID_HANDLE_VALUE)
+#else
 #define event_initialized(ev)		((ev)->ev_flags & EVLIST_INIT)
+#endif
 
 #ifdef __cplusplus
 }
diff -urN libevent-0.6/sample/event-test.c libevent-0.6-win32/sample/event-test.c
--- libevent-0.6/sample/event-test.c	Tue Apr  9 10:14:08 2002
+++ libevent-0.6-win32/sample/event-test.c	Fri Mar 14 18:30:58 2003
@@ -5,13 +5,17 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef WIN32
 #include <sys/queue.h>
+#include <unistd.h>
 #include <sys/time.h>
+#else
+#include <windows.h>
+#endif
 #include <fcntl.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <errno.h>
 
 #include <event.h>
@@ -22,14 +26,29 @@
 	char buf[255];
 	int len;
 	struct event *ev = arg;
+#ifdef WIN32
+	DWORD dwBytesRead;
+#endif
 
 	/* Reschedule this event */
 	event_add(ev, NULL);
 
 	fprintf(stderr, "fifo_read called with fd: %d, event: %d, arg: %p\n",
 		fd, event, arg);
+#ifdef WIN32
+	len = ReadFile((HANDLE)fd, buf, sizeof(buf) - 1, &dwBytesRead, NULL);
 
+	// Check for end of file. 
+	if(len && dwBytesRead == 0) {
+		fprintf(stderr, "End Of File");
+		event_del(ev);
+		return;
+	}
+
+	buf[dwBytesRead + 1] = '\0';
+#else
 	len = read(fd, buf, sizeof(buf) - 1);
+
 	if (len == -1) {
 		perror("read");
 		return;
@@ -39,16 +58,32 @@
 	}
 
 	buf[len] = '\0';
+#endif
 	fprintf(stdout, "Read: %s\n", buf);
 }
 
 int
 main (int argc, char **argv)
 {
+	struct event evfifo;
+#ifdef WIN32
+	HANDLE socket;
+	// Open a file. 
+	socket = CreateFile("test.txt",     // open File 
+			GENERIC_READ,                 // open for reading 
+			0,                            // do not share 
+			NULL,                         // no security 
+			OPEN_EXISTING,                // existing file only 
+			FILE_ATTRIBUTE_NORMAL,        // normal file 
+			NULL);                        // no attr. template 
+
+	if(socket == INVALID_HANDLE_VALUE)
+		return 1;
+
+#else
 	struct stat st;
 	char *fifo = "event.fifo";
 	int socket;
-	struct event evfifo;
  
 	if (lstat (fifo, &st) == 0) {
 		if ((st.st_mode & S_IFMT) == S_IFREG) {
@@ -77,18 +112,24 @@
 	}
 
 	fprintf(stderr, "Write data to %s\n", fifo);
-
+#endif
 	/* Initalize the event library */
 	event_init();
 
 	/* Initalize one event */
+#ifdef WIN32
+	event_set(&evfifo, (int)socket, EV_READ, fifo_read, &evfifo);
+#else
 	event_set(&evfifo, socket, EV_READ, fifo_read, &evfifo);
+#endif
 
 	/* Add it to the active events, without a timeout */
 	event_add(&evfifo, NULL);
 	
 	event_dispatch();
-
+#ifdef WIN32
+	CloseHandle(socket);
+#endif
 	return (0);
 }
 
Binary files libevent-0.6/sample/sample.64650 and libevent-0.6-win32/sample/sample.64650 differ
diff -urN libevent-0.6/sample/signal-test.c libevent-0.6-win32/sample/signal-test.c
--- libevent-0.6/sample/signal-test.c	Tue Apr  9 21:10:47 2002
+++ libevent-0.6-win32/sample/signal-test.c	Fri Mar 14 18:30:58 2003
@@ -5,14 +5,18 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef WIN32
 #include <sys/queue.h>
+#include <unistd.h>
 #include <sys/time.h>
+#else
+#include <windows.h>
+#endif
 #include <signal.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <errno.h>
 
 #include <event.h>
@@ -24,11 +28,11 @@
 {
 	struct event *signal = arg;
 
-	printf("%s: got signal %d\n", __FUNCTION__, EVENT_SIGNAL(signal));
+ printf("%s: got signal %d\n", __FUNCTION__, EVENT_SIGNAL(signal));
 
 	if (called >= 2)
 		event_del(signal);
-
+	
 	called++;
 }
 
diff -urN libevent-0.6/sample/time-test.c libevent-0.6-win32/sample/time-test.c
--- libevent-0.6/sample/time-test.c	Fri Jul 26 09:45:50 2002
+++ libevent-0.6-win32/sample/time-test.c	Fri Mar 14 18:30:58 2003
@@ -5,13 +5,17 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef WIN32
 #include <sys/queue.h>
+#include <unistd.h>
+#else
+#include <time.h>
+#endif
 #include <sys/time.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <errno.h>
 
 #include <event.h>
