Misc fixes for byterun/win32.c

Index: build-tree/ocaml-3.12.1/byterun/win32.c
===================================================================
--- build-tree.orig/ocaml-3.12.1/byterun/win32.c	2008-04-22 07:24:10.000000000 -0500
+++ build-tree/ocaml-3.12.1/byterun/win32.c	2010-02-10 16:16:17.000000000 -0600
@@ -18,7 +18,6 @@
 #include <windows.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <io.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -35,6 +34,26 @@
 
 #include "flexdll.h"
 
+/* XXX including <io.h> gets ../byterun/io.h for some reason.
+ * Including the real io.h using the full path fails because of
+ * some strange bug in the system header file itself.  Give up and
+ * just define _finddata_t explicitly here.
+ */
+#ifndef _FSIZE_T_DEFINED
+typedef unsigned long   _fsize_t;
+#define _FSIZE_T_DEFINED
+
+struct _finddata_t
+{
+  unsigned        attrib;
+  time_t          time_create;
+  time_t          time_access;
+  time_t          time_write;
+  _fsize_t        size;
+  char            name[FILENAME_MAX];
+};
+#endif
+
 #ifndef S_ISREG
 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
 #endif
@@ -93,7 +112,7 @@
   pathlen = strlen(name) + 1;
   if (pathlen < 256) pathlen = 256;
   while (1) {
-    fullname = stat_alloc(pathlen);
+    fullname = caml_stat_alloc(pathlen);
     retcode = SearchPath(NULL,              /* use system search path */
 			 name,
 			 ".exe",            /* add .exe extension if needed */
@@ -107,7 +126,7 @@
       break;
     }
     if (retcode < pathlen) break;
-    stat_free(fullname);
+    caml_stat_free(fullname);
     pathlen = retcode + 1;
   }
   return fullname;
