--- qemu-1.2.1/block/vvfat.c.orig	2012-11-20 02:08:21.000000000 +0100
+++ qemu-1.2.1/block/vvfat.c	2012-11-29 17:13:05.322339800 +0100
@@ -825,7 +825,13 @@
 
 static inline uint32_t sector2cluster(BDRVVVFATState* s,off_t sector_num)
 {
-    return (sector_num-s->faked_sectors)/s->sectors_per_cluster;
+    uint32_t ret;
+
+    if (sector_num < s->faked_sectors)
+        ret = 0;
+    else
+        ret = (sector_num-s->faked_sectors)/s->sectors_per_cluster;
+    return ret;
 }
 
 static inline off_t cluster2sector(BDRVVVFATState* s, uint32_t cluster_num)
--- qemu-1.2.1/configure.orig	2012-11-29 17:10:38.086080200 +0100
+++ qemu-1.2.1/configure	2012-11-29 17:26:46.426599800 +0100
@@ -396,7 +396,7 @@
 CYGWIN*)
   mingw32="yes"
   QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
-  audio_possible_drivers="winwave sdl"
+  audio_possible_drivers="winwave dsound sdl fmod"
   audio_drv_list="winwave"
 ;;
 MINGW32*)
@@ -2300,14 +2300,12 @@
 ##########################################
 # opengl probe, used by milkymist-tmu2
 if test "$opengl" != "no" ; then
-  opengl_libs="-lGL"
+  opengl_libs="-lopengl32"
   cat > $TMPC << EOF
-#include <X11/Xlib.h>
 #include <GL/gl.h>
-#include <GL/glx.h>
 int main(void) { return GL_VERSION != 0; }
 EOF
-  if compile_prog "" "-lGL" ; then
+  if compile_prog "" "-lopengl32" ; then
     opengl=yes
   else
     if test "$opengl" = "yes" ; then
--- qemu-1.2.1/Makefile.orig	2012-11-20 02:08:21.000000000 +0100
+++ qemu-1.2.1/Makefile	2012-11-29 17:13:05.337965000 +0100
@@ -131,8 +131,8 @@
 
 bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
 
-version.o: $(SRC_PATH)/version.rc config-host.h
-	$(call quiet-command,$(WINDRES) -I. -o $@ $<,"  RC    $(TARGET_DIR)$@")
+version.o: $(SRC_PATH)/version.rc config-host.h qemu.ico
+	$(call quiet-command,$(WINDRES) -I. -o $@ '$(shell cygpath -w $<)',"  RC    $(TARGET_DIR)$@")
 
 version-obj-$(CONFIG_WIN32) += version.o
 ######################################################################
@@ -159,7 +159,7 @@
 
 tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \
 	qemu-timer-common.o main-loop.o notify.o \
-	iohandler.o cutils.o iov.o async.o
+	iohandler.o cutils.o iov.o async.o version.o
 tools-obj-$(CONFIG_POSIX) += compatfd.o
 
 qemu-img$(EXESUF): qemu-img.o $(tools-obj-y) $(block-obj-y)
@@ -301,6 +301,7 @@
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_confdir)"
 
 install-sysconfig: install-datadir install-confdir
+	$(INSTALL_DATA) $(SRC_PATH)/qemu.ico "$(DESTDIR)$(qemu_confdir)"
 	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_confdir)"
 	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/cpus-x86_64.conf "$(DESTDIR)$(qemu_datadir)"
 
--- qemu-1.2.1/Makefile.target.orig	2012-11-20 02:08:21.000000000 +0100
+++ qemu-1.2.1/Makefile.target	2012-11-29 17:10:44.304909800 +0100
@@ -146,6 +146,9 @@
 
 endif # CONFIG_SOFTMMU
 
+# Workaround for http://gcc.gnu.org/PR55489, see configure.
+%/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)
+
 nested-vars += obj-y
 
 # This resolves all nested paths, so it must come last
--- qemu-1.2.1/qemu-char.c.orig	2012-11-20 02:08:21.000000000 +0100
+++ qemu-1.2.1/qemu-char.c	2012-11-29 17:13:05.337965000 +0100
@@ -515,6 +515,12 @@
     return len1 - len;
 }
 
+static CharDriverState *qemu_chr_open_fd(int fd_in, int fd_out)
+{
+    /* NOT AVAILABLE */
+    return NULL;
+}
+
 #else
 
 int send_all(int fd, const void *_buf, int len1)
@@ -537,6 +543,7 @@
     }
     return len1 - len;
 }
+
 #endif /* !_WIN32 */
 
 #define STDIO_MAX_CLIENTS 1
--- qemu-1.2.1/ui/vnc-enc-tight.c.orig	2012-11-20 02:08:21.000000000 +0100
+++ qemu-1.2.1/ui/vnc-enc-tight.c	2012-11-29 17:13:05.353590200 +0100
@@ -50,6 +50,8 @@
 #include "vnc-enc-tight.h"
 #include "vnc-palette.h"
 
+typedef unsigned int uint;
+
 /* Compression level stuff. The following array contains various
    encoder parameters for each of 10 compression levels (0..9).
    Last three parameters correspond to JPEG quality levels (0..9). */
--- qemu-1.2.1/version.rc.orig	2012-11-20 02:08:21.000000000 +0100
+++ qemu-1.2.1/version.rc	2012-11-29 17:13:05.353590200 +0100
@@ -1,6 +1,7 @@
 #include <winver.h>
 #include "config-host.h"
 
+500 ICON "qemu.ico"
 VS_VERSION_INFO VERSIONINFO
 FILEVERSION CONFIG_FILEVERSION
 PRODUCTVERSION CONFIG_PRODUCTVERSION