diff --git a/sm5/os_win32/int64_vc6.c b/sm5/os_win32/int64_vc6.c
new file mode 100644
index 0000000000000000000000000000000000000000..566ca87894f8cc5c759d7c5fa43d021b2d777ec8
--- /dev/null
+++ b/sm5/os_win32/int64_vc6.c
@@ -0,0 +1,47 @@
+/*
+ * int64_vc6.c
+ *
+ * Home page of code is: http://smartmontools.sourceforge.net
+ *
+ * Copyright (C) 2004 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * You should have received a copy of the GNU General Public License
+ * (for example COPYING); if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * This code was originally developed as a Senior Thesis by Michael Cornwell
+ * at the Concurrent Systems Laboratory (now part of the Storage Systems
+ * Research Center), Jack Baskin School of Engineering, University of
+ * California, Santa Cruz. http://ssrc.soe.ucsc.edu/
+ *
+ */
+
+#include "int64.h"
+
+#include <stdio.h>
+#include <errno.h>
+
+const char *int64_vc6_c_cvsid = "$Id: int64_vc6.c,v 1.1.2.1 2004/02/25 12:59:55 chrfranke Exp $" \
+INT64_H_CVSID;
+
+
+// strtoull() is missing in MSVC 6.0
+// Used by utility:split_selective_arg()
+
+__int64 strtoull(char * s, char ** end, int base)
+{
+	__int64 val; int n = -1;
+	if (sscanf(s, "%I64i%n", &val, &n) != 1 && n <= 0) {
+		if (end)
+			*end = s;
+		errno = EINVAL; return -1;
+	}
+	if (end)
+		*end = s + n;
+	return val;
+}
diff --git a/sm5/os_win32/os_win32.c b/sm5/os_win32/os_win32.c
index 094af6bbc123327be74ca97a4e1c0b4d17181103..fbf84bdb53062c7eb7d3008bd1bd0fe15a3f83a5 100644
--- a/sm5/os_win32/os_win32.c
+++ b/sm5/os_win32/os_win32.c
@@ -36,27 +36,10 @@ extern smartmonctrl * con; // con->permissive
 
 
 // Needed by '-V' option (CVS versioning) of smartd/smartctl
-const char *os_XXXX_c_cvsid="$Id: os_win32.c,v 1.1.2.1 2004/02/23 15:02:24 chrfranke Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_win32.c,v 1.1.2.2 2004/02/25 12:59:55 chrfranke Exp $" \
 ATACMDS_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID EXTERN_H_CVSID;
 
 
-// Quick hack strtoull() for MSVC 6.0 using sscanf
-// Used by utility:split_selective_arg()
-
-__int64 strtoull(char * s, char ** end, int base)
-{
-	__int64 val; int n = -1;
-	if (sscanf(s, "%I64i%n", &val, &n) != 1 && n <= 0) {
-		if (end)
-			*end = s;
-		errno = EINVAL; return -1;
-	}
-	if (end)
-		*end = s + n;
-	return val;
-}
-
-
 static int ata_open(int drive);
 static void ata_close(int fd);
 static int aspi_open(unsigned adapter, unsigned id);
@@ -374,7 +357,7 @@ static int ide_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, u
 	buf->DataBufferSize = datasize;
 
 #ifdef _DEBUG
-	pout("DeviceIoControl(.,0x%lx,.,%lu,.,%lu,.,NULL)\n",
+	pout("DeviceIoControl(.,0x%x,.,%u,.,%u,.,NULL)\n",
 		IOCTL_IDE_PASS_THROUGH, size, size);
 	print_ide_regs(&buf->IdeReg, 0);
 #endif
@@ -808,7 +791,7 @@ static int aspi_io_call(ASPI_SRB * srb)
 			}
 			else {
 				pout("WaitForSingleObject(%lx) = 0x%lx,%ld, Error=%ld\n",
-					event, rc, rc, GetLastError());
+					(unsigned long)event, rc, rc, GetLastError());
 			}
 			// TODO: ASPI_ABORT_IO command
 			aspi_entry = 0;
@@ -891,7 +874,7 @@ int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
 		}
 		else
 			j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "]\n");
-	pout(buff);
+		pout(buff);
 	}
 
 	memset(&srb, 0, sizeof(srb));
diff --git a/sm5/os_win32/smartctl_vc6.dsp b/sm5/os_win32/smartctl_vc6.dsp
index 43661dd7229620c79c8d51856740984a9ea6bbd8..783e9dc5444b122fa2b1342bda9230a70d5bd651 100644
--- a/sm5/os_win32/smartctl_vc6.dsp
+++ b/sm5/os_win32/smartctl_vc6.dsp
@@ -181,6 +181,10 @@ SOURCE=..\int64.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\int64_vc6.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\knowndrives.c
 # End Source File
 # Begin Source File