--- egg/egg-secure-memory.c	2012-11-12 07:30:20 +0000
+++ egg/egg-secure-memory.c	2013-11-21 00:47:57 +0000
@@ -32,7 +32,9 @@
 #include "egg-secure-memory.h"
 
 #include <sys/types.h>
+#ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
+#endif
 #include <stddef.h>
 #include <string.h>
 #include <stdio.h>
@@ -188,9 +190,11 @@
 	
 	/* Create a new pool */
 	if (pool == NULL) {
+#if !defined(_WIN32)
 		len = getpagesize () * 2;
 		pages = mmap (0, len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
 		if (pages == MAP_FAILED)
+#endif
 			return NULL;
 
 		/* Fill in the block header, and inlude in block list */
@@ -254,7 +258,9 @@
 		VALGRIND_DESTROY_MEMPOOL (pool);
 #endif
 
+#if !defined(_WIN32)
 		munmap (pool, pool->length);
+#endif
 		return;
 	}
 
@@ -860,11 +866,11 @@
 	ASSERT (*sz);
 	ASSERT (during_tag);
 
+#if defined(HAVE_MLOCK)
 	/* Make sure sz is a multiple of the page size */
 	pgsize = getpagesize ();
 	*sz = (*sz + pgsize -1) & ~(pgsize - 1);
-	
-#if defined(HAVE_MLOCK)
+
 	pages = mmap (0, *sz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
 	if (pages == MAP_FAILED) {
 		if (show_warning && egg_secure_warnings)
@@ -902,9 +908,10 @@
 sec_release_pages (void *pages, size_t sz)
 {
 	ASSERT (pages);
-	ASSERT (sz % getpagesize () == 0);
-	
+
 #if defined(HAVE_MLOCK)
+	ASSERT (sz % getpagesize () == 0);
+
 	if (munlock (pages, sz) < 0 && egg_secure_warnings)
 		fprintf (stderr, "couldn't unlock private memory: %s\n", strerror (errno));
 		
@@ -914,7 +921,7 @@
 	DEBUG_ALLOC ("gkr-secure-memory: freed block ", sz);
 	
 #else
-	ASSERT (FALSE);
+	ASSERT (0);
 #endif
 }
 
@@ -937,6 +944,11 @@
 	if (getenv ("SECMEM_FORCE_FALLBACK"))
 		return NULL;
 
+#ifdef _WIN32
+	/* win32 does not have mlock(), so just fail in that case */
+	return NULL;
+#endif
+
 	block = pool_alloc ();
 	if (!block)
 		return NULL;
--- egg/egg-asn1x.c	2012-11-12 07:30:20 +0000
+++ egg/egg-asn1x.c	2013-11-17 19:59:37 +0000
@@ -1846,7 +1846,7 @@
 two_to_four_digit_year (int year)
 {
 	time_t now;
-	struct tm tm;
+	GDate *date;
 	int century, current;
 
 	g_return_val_if_fail (year >= 0 && year <= 99, -1);
@@ -1854,11 +1854,15 @@
 	/* Get the current year */
 	now = time (NULL);
 	g_return_val_if_fail (now >= 0, -1);
-	if (!gmtime_r (&now, &tm))
+	date = g_date_new ();
+	g_date_set_time_t (date, now);
+	if (!g_date_valid (date))
 		g_return_val_if_reached (-1);
 
-	current = (tm.tm_year % 100);
-	century = (tm.tm_year + 1900) - current;
+	century = (g_date_get_year (date) / 100) * 100;
+	current = g_date_get_year (date) - century;
+
+	g_date_free (date);
 
 	/*
 	 * Check if it's within 40 years before the
--- egg/egg-armor.c	2012-09-19 09:01:27 +0000
+++ egg/egg-armor.c	2013-11-17 20:41:27 +0000
@@ -60,6 +60,29 @@
 #define ARMOR_PREF_END      "-----END "
 #define ARMOR_PREF_END_L    9
 
+#ifndef HAVE_MEMRCHR
+extern void* memrchr (const void *s, int c, size_t n);
+
+void*
+memrchr (const void *s, int c, size_t n)
+{
+	if (n > 0) {
+		const char*  p = (const char*) s;
+		const char*  q = p + n;
+
+		while (1) {
+			q--; if (q < p || q[0] == (char) c) break;
+			q--; if (q < p || q[0] == (char) c) break;
+			q--; if (q < p || q[0] == (char) c) break;
+			q--; if (q < p || q[0] == (char) c) break;
+		}
+		if (q >= p)
+			return (void*)q;
+	}
+	return NULL;
+}
+#endif
+
 static void
 parse_header_lines (const gchar *hbeg,
                     const gchar *hend,
--- egg/tests/test-asn1x.c	2012-11-12 07:30:20 +0000
+++ egg/tests/test-asn1x.c	2013-10-16 09:55:04 +0000
@@ -27,7 +27,9 @@
 #include "egg/egg-asn1-defs.h"
 #include "egg/egg-testing.h"
 
+#ifdef HAVE_PWD_H
 #include <pwd.h>
+#endif
 #include <stdlib.h>
 #include <unistd.h>
 
--- gck/gck-slot.c	2012-10-27 13:03:06 +0000
+++ gck/gck-slot.c	2013-11-17 20:08:09 +0000
@@ -605,7 +605,7 @@
 {
 	GckTokenInfo *token_info;
 	gchar *string;
-	struct tm tm;
+	GTimeVal tv;
 
 	token_info = g_new0 (GckTokenInfo, 1);
 	token_info->label = gck_string_from_chars (info->label, sizeof (info->label));
@@ -633,10 +633,12 @@
 	/* Parse the time into seconds since epoch */
 	if (info->flags & CKF_CLOCK_ON_TOKEN) {
 		string = g_strndup ((gchar*)info->utcTime, MIN (14, sizeof (info->utcTime)));
-		if (!strptime (string, "%Y%m%d%H%M%S", &tm))
+                /* Transform into an ISO-8601 string */
+		string = g_strconcat (g_strndup (string,8), "T", g_strndup (string+8,6), "Z", NULL);
+		if (!g_time_val_from_iso8601 (string, &tv))
 			token_info->utc_time = -1;
 		else
-			token_info->utc_time = timegm (&tm);
+			token_info->utc_time = tv.tv_sec;
 		g_free (string);
 	} else {
 		token_info->utc_time = -1;
@@ -648,8 +650,8 @@
 void
 _gck_token_info_to_pkcs11 (GckTokenInfo *token_info, CK_TOKEN_INFO_PTR info)
 {
-	gchar buffer[64];
-	struct tm tm;
+	gchar *buffer;
+	GDateTime *datetime = NULL;
 	time_t tim;
 	gsize len;
 
@@ -689,9 +691,12 @@
 	/* Parse the time into seconds since epoch */
 	if (token_info->flags & CKF_CLOCK_ON_TOKEN) {
 		tim = token_info->utc_time;
-		if (!gmtime_r (&tim, &tm))
+		datetime = g_date_time_new_from_unix_utc (tim);
+		if (datetime == NULL)
 			g_return_if_reached ();
-		len = strftime (buffer, sizeof (buffer), "%Y%m%d%H%M%S", &tm);
+		buffer = g_date_time_format (datetime, "%Y%m%d%H%M%S");
+		len = strlen (buffer);
+		g_date_time_unref (datetime);
 		g_return_if_fail (len == sizeof (info->utcTime));
 		memcpy (info->utcTime, buffer, sizeof (info->utcTime));
 	} else {
--- gcr/gcr-gnupg-collection.c	2011-10-06 08:06:09 +0000
+++ gcr/gcr-gnupg-collection.c	2013-10-21 20:28:35 +0000
@@ -36,7 +36,9 @@
 #include "gcr-record.h"
 #include "gcr-util.h"
 
+#ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
+#endif
 #include <string.h>
 
 enum {
--- gcr/gcr-gnupg-process.c	2012-09-19 09:01:28 +0000
+++ gcr/gcr-gnupg-process.c	2013-11-17 03:19:13 +0000
@@ -31,11 +31,24 @@
 
 #include <glib/gi18n-lib.h>
 
+#ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
+#endif
+#ifdef G_OS_WIN32
+#define WINVER 0x0501
+#include <windows.h>
+#endif
 #include <fcntl.h>
 #include <errno.h>
 #include <string.h>
 
+#ifndef G_OS_UNIX
+#define WIFEXITED(x) 1
+#define WEXITSTATUS(x) (x)
+#define WIFSIGNALED(x) 0
+#define WTERMSIG(x) (x)
+#endif
+
 /**
  * GcrGnupgProcessFlags:
  * @GCR_GNUPG_PROCESS_NONE: No flags
@@ -853,7 +866,12 @@
 	gint code;
 	guint i;
 
+#if defined (G_OS_UNIX)
 	_gcr_debug ("process exited: %d", (int)pid);
+#elif defined (G_OS_WIN32)
+	DWORD real_pid = GetProcessId (pid);
+	_gcr_debug ("process exited: %d", (int)real_pid);
+#endif
 
 	g_spawn_close_pid (gnupg_source->child_pid);
 	gnupg_source->child_pid = 0;
@@ -890,11 +908,16 @@
 	}
 
 	complete_source_is_done (gnupg_source);
+
+#ifdef G_OS_WIN32
+	g_spawn_close_pid (pid);
+#endif
 }
 
 static void
 on_gnupg_process_child_setup (gpointer user_data)
 {
+#ifdef G_OS_UNIX 
 	int *child_fds = user_data;
 	long val;
 	guint i;
@@ -910,6 +933,7 @@
 			fcntl (child_fds[i], F_SETFD, val & ~FD_CLOEXEC);
 		}
 	}
+#endif
 }
 
 static void
@@ -928,9 +952,16 @@
 
 	/* Try and kill the child process */
 	if (gnupg_source->child_pid) {
+#if defined(G_OS_UNIX)
 		_gcr_debug ("sending term signal to process: %d",
 		            (int)gnupg_source->child_pid);
 		kill (gnupg_source->child_pid, SIGTERM);
+#elif defined(G_OS_WIN32)
+		DWORD real_pid = GetProcessId (gnupg_source->child_pid);
+		_gcr_debug ("sending term signal to process: %d",
+		            (int)real_pid);
+		TerminateProcess (gnupg_source->child_pid, 0);
+#endif
 	}
 }
 
@@ -999,14 +1030,22 @@
 	child_fds[FD_ERROR] = 2;
 
 	if (flags & GCR_GNUPG_PROCESS_WITH_STATUS) {
+#if defined(G_OS_UNIX)
 		if (pipe (status_fds) < 0)
+#elif defined(G_OS_WIN32)
+		if (_pipe (status_fds, 4096, _O_BINARY) < 0)
+#endif
 			g_return_if_reached ();
 		child_fds[FD_STATUS] = status_fds[1];
 		g_ptr_array_add (args, g_strdup ("--status-fd"));
 		g_ptr_array_add (args, g_strdup_printf ("%d", child_fds[FD_STATUS]));
 	}
 	if (flags & GCR_GNUPG_PROCESS_WITH_ATTRIBUTES) {
+#if defined(G_OS_UNIX)
 		if (pipe (attribute_fds) < 0)
+#elif defined(G_OS_WIN32)
+		if (_pipe (attribute_fds, 4096, _O_BINARY) < 0)
+#endif
 			g_return_if_reached ();
 		child_fds[FD_ATTRIBUTE] = attribute_fds[1];
 		g_ptr_array_add (args, g_strdup ("--attribute-fd"));
@@ -1035,11 +1074,11 @@
 
 	if (_gcr_debugging) {
 		gchar *command = g_strjoinv (" ", (gchar**)args->pdata);
-		gchar *environ = g_strjoinv (", ", (gchar**)envs->pdata);
+		gchar *environment = g_strjoinv (", ", (gchar**)envs->pdata);
 		_gcr_debug ("running command: %s", command);
-		_gcr_debug ("process environment: %s", environ);
+		_gcr_debug ("process environment: %s", environment);
 		g_free (command);
-		g_free (environ);
+		g_free (environment);
 	}
 
 	g_spawn_async_with_pipes (self->pv->directory, (gchar**)args->pdata,
@@ -1067,7 +1106,12 @@
 		return;
 	}
 
+#if defined (G_OS_UNIX)
 	_gcr_debug ("process started: %d", (int)pid);
+#elif defined (G_OS_WIN32)
+	DWORD real_pid = GetProcessId (pid);
+	_gcr_debug ("process started: %d", (int)real_pid);
+#endif
 
 	source = g_source_new (&gnupg_source_funcs, sizeof (GnupgSource));
 
--- gcr/gcr-prompt-dialog.c	2012-11-12 07:30:20 +0000
+++ gcr/gcr-prompt-dialog.c	2013-11-17 05:38:59 +0000
@@ -30,7 +30,13 @@
 #include "gcr-secure-entry-buffer.h"
 
 #include <gtk/gtk.h>
+#if defined(GDK_WINDOWING_X11)
 #include <gdk/gdkx.h>
+#endif
+#if defined(GDK_WINDOWING_WIN32)
+#include <gdk/gdkwin32.h>
+#include <windows.h>
+#endif
 #include <glib/gi18n.h>
 
 /**
@@ -148,12 +154,21 @@
 	}
 
 	display = gtk_widget_get_display (GTK_WIDGET (self));
+#if defined(GDK_WINDOWING_X11)
 	transient_for = gdk_x11_window_foreign_new_for_display (display, (Window)handle);
+#elif defined(GDK_WINDOWING_WIN32)
+	transient_for = gdk_win32_window_foreign_new_for_display (display, (HWND)handle);
+#endif
 	if (transient_for == NULL) {
 		g_warning ("caller-window property doesn't represent a window on current display: %s",
 		           self->pv->caller_window);
 	} else {
+#if defined(GDK_WINDOWING_X11)
 		gdk_window_set_transient_for (window, transient_for);
+#elif defined(GDK_WINDOWING_WIN32)
+		HWND chandle = gdk_win32_window_get_handle (window);
+		SetWindowLongPtr (chandle, GWLP_HWNDPARENT, (LONG_PTR)handle);
+#endif
 		g_object_unref (transient_for);
 	}
 
--- gcr/gcr-prompter-tool.c	2012-11-12 07:30:20 +0000
+++ gcr/gcr-prompter-tool.c	2013-10-22 07:17:23 +0000
@@ -31,13 +31,17 @@
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+#ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
+#endif
 #include <pango/pango.h>
 
 #include <locale.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef HAVE_SYSLOG_H
 #include <syslog.h>
+#endif
 
 #define QUIT_TIMEOUT 10
 
@@ -139,6 +143,7 @@
              const gchar *message,
              gpointer user_data)
 {
+#ifdef HAVE_SYSLOG_H
 	int level;
 
 	/* Note that crit and err are the other way around in syslog */
@@ -172,6 +177,7 @@
 		syslog (level, "%s: %s", log_domain, message);
 	else
 		syslog (level, "%s", message);
+#endif
 
 	/* And then to default handler for aborting and stuff like that */
 	g_log_default_handler (log_domain, log_level, message, user_data);
@@ -180,9 +186,11 @@
 static void
 printerr_handler (const gchar *string)
 {
+#ifdef HAVE_SYSLOG_H
 	/* Print to syslog and stderr */
 	syslog (LOG_WARNING, "%s", string);
 	fprintf (stderr, "%s", string);
+#endif
 }
 
 static void
@@ -192,7 +200,9 @@
 	                       G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING |
 	                       G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO;
 
+#ifdef HAVE_SYSLOG_H
 	openlog ("gcr-prompter", LOG_PID, LOG_AUTH);
+#endif
 
 	g_log_set_handler (NULL, flags, log_handler, NULL);
 	g_log_set_handler ("Glib", flags, log_handler, NULL);
--- gcr/gcr-record.c	2012-09-19 09:01:28 +0000
+++ gcr/gcr-record.c	2013-11-17 20:20:37 +0000
@@ -597,7 +597,9 @@
 	const gchar *raw;
 	gulong result;
 	gchar *end = NULL;
-	struct tm tm;
+	gchar **string;
+	int year, month, day;
+	GDateTime *dt = NULL;
 
 	g_return_val_if_fail (record, NULL);
 
@@ -615,14 +617,20 @@
 	}
 
 	/* Try to parse as a date */
-	memset (&tm, 0, sizeof (tm));
-	end = strptime (raw, "%Y-%m-%d", &tm);
-	if (!end || end[0]) {
+	string = g_strsplit (raw, "-", 3);
+	if ((string[0] != NULL) && (string[1] != NULL) && (string[2] != NULL)) {
+		year = strtol (string[0], NULL, 10);
+		month = strtol (string[1], NULL, 10);
+		day = strtol (string[2], NULL, 10);
+		dt = g_date_time_new_utc (year, month, day, 0, 0, 0);
+	}
+	g_strfreev (string);
+	if (dt == NULL) {
 		_gcr_debug ("invalid date value: %s", raw);
 		return NULL;
 	}
 
-	return g_date_time_new_utc (tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 0, 0, 0);
+	return dt;
 }
 
 /**
@@ -860,4 +868,4 @@
 	g_free (lines);
 
 	return result;
-}
+}
\ No newline at end of file
--- gcr/tests/frob-prompt.c	2012-11-12 07:30:20 +0000
+++ gcr/tests/frob-prompt.c	2013-11-17 06:31:09 +0000
@@ -27,15 +27,45 @@
 #include "gcr/gcr-base.h"
 
 #include <gtk/gtk.h>
+#ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
+#endif
+#ifdef GDK_WINDOWING_WIN32
+#include <gdk/gdkwin32.h>
+#endif
 
+#if defined(HAVE_ERR_H)
 #include <err.h>
+#else
+#include <errno.h>
+#endif
+#include <stdlib.h>
 
 static const gchar *file_name = NULL;
 static gchar *prompt_type = NULL;
 static gint prompt_delay = 0;
 static gboolean prompt_window = FALSE;
 
+#ifndef HAVE_ERR_H
+extern void errx (int eval, char *format, ...);
+
+void errx (int eval, char *format, ...)
+{
+	gchar *err_s;
+
+	va_list ap;
+	va_start (ap, format);
+	vsprintf (err_s, format, ap);
+	va_end (ap);
+
+	err_s = g_strconcat (g_get_prgname (), ": ", g_strdup (err_s), "\n", NULL);
+	g_printerr (err_s);
+	g_free (err_s);
+
+	exit (eval);
+}
+#endif
+
 static void
 prompt_perform (GtkWidget *parent)
 {
@@ -72,7 +102,11 @@
 		errx (1, "couldn't create prompt: %s", error->message);
 
 	if (parent) {
+#if defined(GDK_WINDOWING_X11)
 		caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_XID (gtk_widget_get_window (parent)));
+#elif defined(GDK_WINDOWING_WIN32)
+		caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_HWND (gtk_widget_get_window (parent)));
+#endif
 		gcr_prompt_set_caller_window (GCR_PROMPT (prompt), caller_id);
 		g_free (caller_id);
 	}
--- gcr/tests/frob-system-prompt.c	2012-11-12 07:30:20 +0000
+++ gcr/tests/frob-system-prompt.c	2013-11-17 05:46:58 +0000
@@ -26,7 +26,12 @@
 #include "gcr/gcr.h"
 
 #include <gtk/gtk.h>
+#ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
+#endif
+#ifdef GDK_WINDOWING_WIN32
+#include <gdk/gdkwin32.h>
+#endif
 
 #include <unistd.h>
 #include <string.h>
@@ -53,7 +58,11 @@
 	gcr_prompt_set_message (GCR_PROMPT (prompt), "This is the message");
 	gcr_prompt_set_description (GCR_PROMPT (prompt), "This is the description");
 
+#if defined(GDK_WINDOWING_X11)
 	caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_XID (gtk_widget_get_window (parent)));
+#elif defined(GDK_WINDOWING_WIN32)
+	caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_HWND (gtk_widget_get_window (parent)));
+#endif
 	gcr_prompt_set_caller_window (GCR_PROMPT (prompt), caller_id);
 	g_free (caller_id);
 
--- gck/gck-debug.c	2012-10-27 13:03:44 +0000
+++ gck/gck-debug.c	2013-11-18 05:45:51 +0000
@@ -29,6 +29,11 @@
 
 #include <p11-kit/pkcs11.h>
 
+#ifdef G_OS_WIN32
+#define WINVER 0x0501
+#include <windows.h>
+#endif
+
 #ifdef WITH_DEBUG
 
 static gsize initialized_flags = 0;
@@ -68,13 +73,20 @@
 
 	gstring = g_string_new (NULL);
 
+#if defined (G_OS_UNIX)
+	pid_t pid = getpid ();
+#elif defined (G_OS_WIN32)
+	HANDLE handle = GetCurrentProcess ();
+	DWORD pid = GetProcessId (handle);
+#endif
+
 	progname = g_get_prgname ();
 	g_string_append_printf (gstring, "(%s:%lu): %s-DEBUG: %s\n",
 	                        progname ? progname : "process",
-	                        (gulong)getpid (), log_domain,
+	                        (gulong)pid, log_domain,
 	                        message ? message : "(NULL) message");
 
-	write (1, gstring->str, gstring->len);
+	g_print (gstring->str);
 	g_string_free (gstring, TRUE);
 }
 
--- gck/tests/test-gck-crypto.c	2012-11-12 07:30:20 +0000
+++ gck/tests/test-gck-crypto.c	2013-11-21 01:21:32 +0000
@@ -57,7 +57,11 @@
 	GckSlot *slot;
 
 	/* Successful load */
+#ifdef G_OS_WIN32
+	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
+#else
 	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
+#endif
 	g_assert_no_error (err);
 	g_assert (GCK_IS_MODULE (test->module));
 
--- gck/tests/test-gck-enumerator.c	2012-11-12 07:30:20 +0000
+++ gck/tests/test-gck-enumerator.c	2013-11-21 01:25:17 +0000
@@ -50,7 +50,11 @@
 	GError *err = NULL;
 
 	/* Successful load */
+#ifdef G_OS_WIN32
+	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
+#else
 	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
+#endif
 	g_assert_no_error (err);
 	g_assert (GCK_IS_MODULE (test->module));
 
--- gck/tests/test-gck-module.c	2012-11-12 07:30:20 +0000
+++ gck/tests/test-gck-module.c	2013-11-21 01:37:29 +0000
@@ -42,7 +42,11 @@
 	GError *err = NULL;
 
 	/* Successful load */
+#ifdef G_OS_WIN32
+	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
+#else
 	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
+#endif
 	g_assert_no_error (err);
 	g_assert (test->module);
 }
@@ -70,7 +74,11 @@
 	GError *error = NULL;
 
 	/* Shouldn't be able to load modules */
+#ifdef G_OS_WIN32
+	gck_module_initialize_async (BUILDDIR "/.libs/libmock-test-module.dll",
+#else
 	gck_module_initialize_async (BUILDDIR "/.libs/libmock-test-module.so",
+#endif
 	                             NULL, fetch_async_result, &result);
 
 	egg_test_wait_until (500);
@@ -100,7 +108,11 @@
 	g_clear_error (&error);
 
 	/* Shouldn't be able to load any file successfully */
+#ifdef G_OS_WIN32
+	invalid = gck_module_initialize ("c:\\windows\\system32\\shell32.dll", NULL, &error);
+#else
 	invalid = gck_module_initialize ("/usr/lib/libm.so", NULL, &error);
+#endif
 	g_assert_error (error, GCK_ERROR, (int)CKR_GCK_MODULE_PROBLEM);
 	g_assert (invalid == NULL);
 
@@ -138,7 +150,11 @@
 
 	g_object_get (test->module, "path", &path, NULL);
 	g_assert (path != NULL && "no module-path");
+#ifdef G_OS_WIN32
+	g_assert (strcmp (BUILDDIR "/.libs/libmock-test-module.dll", path) == 0 && "module path wrong");
+#else
 	g_assert (strcmp (BUILDDIR "/.libs/libmock-test-module.so", path) == 0 && "module path wrong");
+#endif
 	g_free (path);
 }
 
--- gck/tests/test-gck-modules.c	2012-11-12 07:30:20 +0000
+++ gck/tests/test-gck-modules.c	2013-11-21 01:39:33 +0000
@@ -48,7 +48,11 @@
 	GError *err = NULL;
 
 	/* Successful load */
+#ifdef G_OS_WIN32
+	module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
+#else
 	module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
+#endif
 	g_assert_no_error (err);
 	g_assert (GCK_IS_MODULE (module));
 
--- gck/tests/test-gck-object.c	2012-11-12 07:30:20 +0000
+++ gck/tests/test-gck-object.c	2013-11-21 01:41:16 +0000
@@ -50,7 +50,11 @@
 	GList *slots;
 
 	/* Successful load */
+#ifdef G_OS_WIN32
+	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
+#else
 	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
+#endif
 	g_assert_no_error (err);
 	g_assert (GCK_IS_MODULE (test->module));
 
--- gck/tests/test-gck-session.c	2012-11-12 07:30:20 +0000
+++ gck/tests/test-gck-session.c	2013-11-21 01:43:05 +0000
@@ -50,7 +50,11 @@
 	GList *slots;
 
 	/* Successful load */
+#ifdef G_OS_WIN32
+	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
+#else
 	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
+#endif
 	g_assert_no_error (err);
 	g_assert (GCK_IS_MODULE (test->module));
 
--- gck/tests/test-gck-slot.c	2012-11-12 07:30:20 +0000
+++ gck/tests/test-gck-slot.c	2013-11-21 01:44:46 +0000
@@ -43,7 +43,11 @@
 	GList *slots;
 
 	/* Successful load */
+#ifdef G_OS_WIN32
+	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
+#else
 	test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
+#endif
 	g_assert_no_error (err);
 	g_assert (GCK_IS_MODULE (test->module));
 
