--- boilerplate/cairo-boilerplate.c~0	2013-08-26 18:07:21.000000000 +0300
+++ boilerplate/cairo-boilerplate.c	2013-11-18 09:03:15.497080400 +0200
@@ -801,7 +801,11 @@
 
     any2ppm = getenv ("ANY2PPM");
     if (any2ppm == NULL)
+#ifdef _WIN32
+	any2ppm = ".\\any2ppm.exe";
+#else
 	any2ppm = "./any2ppm";
+#endif
 
 #if HAS_DAEMON
     if (flags & CAIRO_BOILERPLATE_OPEN_NO_DAEMON)
@@ -839,7 +843,7 @@
 
     *close_cb = pclose;
     sprintf (command, "%s %s %d", any2ppm, filename, page);
-    return popen (command, "r");
+    return popen (command, "rb");
 }
 
 static cairo_bool_t
--- src/cairo-mutex-impl-private.h~0	2013-08-26 18:07:21.000000000 +0300
+++ src/cairo-mutex-impl-private.h	2013-11-18 09:13:25.819020200 +0200
@@ -180,9 +180,15 @@
 #define WIN32_LEAN_AND_MEAN
 /* We require Windows 2000 features such as ETO_PDY */
 #if !defined(WINVER) || (WINVER < 0x0500)
+# if defined(WINVER)
+#  undef WINVER
+# endif
 # define WINVER 0x0500
 #endif
 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
+# if defined(_WIN32_WINNT)
+#  undef _WIN32_WINNT
+# endif
 # define _WIN32_WINNT 0x0500
 #endif
 
--- util/cairo-missing/cairo-missing.h~0	2013-08-26 18:07:21.000000000 +0300
+++ util/cairo-missing/cairo-missing.h	2013-11-18 06:58:26.445410600 +0200
@@ -41,7 +41,7 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
-#ifndef _SSIZE_T_DEFINED
+#if !defined(_SSIZE_T_DEFINED) && !defined(_SSIZE_T_)
 typedef SSIZE_T ssize_t;
 #endif
 #endif
--- test/any2ppm.c~	2013-08-26 18:07:21.000000000 +0300
+++ test/any2ppm.c	2013-11-18 09:37:05.351421000 +0200
@@ -61,6 +61,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef _WIN32
+#include <fcntl.h>
+#endif
+
 #include <cairo.h>
 #include <cairo-script-interpreter.h>
 
@@ -871,8 +875,12 @@
 
     if (argc == 1)
 	err = any2ppm_daemon ();
-    else
+    else {
+#ifdef _WIN32
+	_setmode (1, _O_BINARY);
+#endif
 	err = convert (argv + 1, 1);
+    }
     if (err != NULL) {
 	fprintf (stderr, "Failed to run converter: %s\n", err);
 	return EXIT_FAILURE;
