--- glib/grand.c.orig	2014-09-14 10:29:54.000000000 +0800
+++ glib/grand.c	2014-09-14 12:03:32.000000000 +0800
@@ -58,2 +58,5 @@
 #include <stdlib.h>
+  #if !defined(_MSC_VER) || _MSC_VER < 1400
+  #include <process.h>
+  #endif
 #endif
@@ -263,2 +266,4 @@
 #else /* G_OS_WIN32 */
+  /* rand_s() is only available since Visual Studio 2005 */
+#if defined(_MSC_VER) && _MSC_VER >= 1400
   gint i;
@@ -267,2 +272,11 @@
     rand_s (&seed[i]);
+#else
+  GTimeVal now;
+
+  g_get_current_time (&now);
+  seed[0] = now.tv_sec;
+  seed[1] = now.tv_usec;
+  seed[2] = _getpid ();
+  seed[3] = 0;
+#endif
