Pull up Win64 support from 0.9.8.
diff --git a/util/mk1mf.pl b/util/mk1mf.pl
index fa0fbe3..6090a2b 100755
--- a/util/mk1mf.pl
+++ b/util/mk1mf.pl
@@ -24,6 +24,8 @@
 
 %ops=(
 	"VC-WIN32",   "Microsoft Visual C++ [4-6] - Windows NT or 9X",
+	"VC-WIN64I",  "Microsoft C/C++ - Win64/IA-64",
+	"VC-WIN64A",  "Microsoft C/C++ - Win64/x64",
 	"VC-CE",   "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY",
 	"VC-NT",   "Microsoft Visual C++ [4-6] - Windows NT ONLY",
 	"Mingw32", "GNU C++ - Windows NT or 9x",
@@ -120,9 +122,10 @@
 $NT=0;
 
 push(@INC,"util/pl","pl");
-if (($platform eq "VC-WIN32") || ($platform eq "VC-NT"))
+if (($platform =~ /VC-(.+)/))
 	{
-	$NT = 1 if $platform eq "VC-NT";
+	$FLAVOR=$1;
+	$NT = 1 if $1 eq "NT";
 	require 'VC-32.pl';
 	}
 elsif ($platform eq "VC-CE")
diff --git a/util/pl/VC-32.pl b/util/pl/VC-32.pl
index 710c4cd..d39715c 100644
--- a/util/pl/VC-32.pl
+++ b/util/pl/VC-32.pl
@@ -11,8 +11,27 @@
 
 # C compiler stuff
 $cc='cl';
-$cflags=' /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
-$lflags="/nologo /subsystem:console /machine:I386 /opt:ref";
+if ($FLAVOR =~ /WIN64/)
+    {
+    # Note that we currently don't have /WX on Win64! There is a lot of
+    # warnings, but only of two types:
+    #
+    # C4344: conversion from '__int64' to 'int/long', possible loss of data
+    # C4267: conversion from 'size_t' to 'int/long', possible loss of data
+    #
+    # Amount of latter type is minimized by aliasing strlen to function of
+    # own desing and limiting its return value to 2GB-1 (see e_os.h). As
+    # per 0.9.8 release remaining warnings were explicitly examines and
+    # considered safe to ignore.
+    # 
+    $cflags=' /MD /W3 /Ox /Gs0 /GF /Gy /nologo -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DOPENSSL_SYSNAME_WIN32 -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE';
+    $lflags="/nologo /subsystem:console /opt:ref";
+    }
+else
+    {
+    $cflags=' /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
+    $lflags="/nologo /subsystem:console /machine:I386 /opt:ref";
+    }
 $mlflags='';
 
 $out_def="out32";
@@ -38,6 +57,7 @@
 if ($no_sock)
 	{ $ex_libs=""; }
 else	{ $ex_libs="wsock32.lib user32.lib gdi32.lib"; }
+$ex_libs="$ex_libs bufferoverflowu.lib" if ($FLAVOR =~ /WIN64/);
 
 # static library stuff
 $mklib='lib';
@@ -116,6 +136,9 @@
 LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj
 CRYPTOOBJ=$(OBJ_D)\uplink.obj $(CRYPTOOBJ)
 ___
+	$banner.=<<'___' if ($FLAVOR =~ /WIN64/);
+CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ)
+___
 	}
 
 $cflags.=" /Fd$out_def";
@@ -140,6 +163,7 @@
 		{
 		local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
 		$ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib';
+		$ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/);
 		$ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n  \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
 		}
 	$ret.="\n";