Index: sigtool/sigtool.c
===================================================================
--- sigtool/sigtool.c	(.../vendor/clamav/current)	(revision 845)
+++ sigtool/sigtool.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -24,24 +24,35 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <zlib.h>
 #include <time.h>
 #include <locale.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <clamav.h>
+
+#ifdef C_WIN32
+#include <windows.h>
+#include <io.h>
+#include <conio.h>
+#include <direct.h>
+#include <process.h>
+#include <w32_dirent.h>
+#else
+#include <unistd.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <clamav.h>
 #include <sys/wait.h>
 #include <dirent.h>
+#define closesocket close
+#include "strings.h"
+#endif
 
 #include "options.h"
 #include "others.h"
-#include "strings.h"
 #include "md5.h"
 #include "cvd.h"
 #include "str.h"
@@ -139,7 +150,7 @@
     } else if(optl(opt, "html-normalise")) {
 	    int fd;
 
-	if((fd = open(getargl(opt, "html-normalise"), O_RDONLY)) == -1) {
+	if((fd = open(getargl(opt, "html-normalise"), O_BINARY|O_RDONLY)) == -1) {
 	    mprintf("Can't open file %s\n", getargl(opt, "html-normalise"));
 	    exit(1);
 	}
@@ -182,7 +193,11 @@
  
         /* generate the temporary directory */
         dir = cli_gentemp(NULL);
+#ifdef C_WIN32
+        if(mkdir(dir)) {
+#else
         if(mkdir(dir, 0700)) {
+#endif
             mprintf("vba dump: Can't create temporary directory %s\n", dir);
             return;
         }
@@ -283,6 +298,17 @@
 
     tarfile = cli_gentemp(".");
 
+#ifdef C_WIN32
+	{
+		char *args[] = { "tar", "-cvf", NULL, "COPYING", "main.db", "daily.db", "Notes", "viruses.db3", "main.hdb", "daily.hdb", "main.ndb", "daily.ndb", "main.zmd", "daily.zmd", "main.rmd", "daily.rmd", "main.fp", "daily.fp", NULL };
+		args[2] = tarfile;
+		if (spawnvp(P_WAIT, "tar", args) == -1) {
+			mprintf("!Can't execute tar\n");
+			perror("tar");
+			exit(1);
+		}
+	}
+#else
     switch(fork()) {
 	case -1:
 	    mprintf("!Can't fork.\n");
@@ -299,6 +325,7 @@
 	default:
 	    wait(NULL);
     }
+#endif
 
     if(stat(tarfile, &foo) == -1) {
 	mprintf("!Can't generate tar file.\n");
@@ -328,7 +355,7 @@
 
     /* try to read cvd header of old database */
     dbdir = freshdbdir();
-    sprintf(buffer, "%s/%s", dbdir, getargc(opt, 'b'));
+    sprintf(buffer, "%s" PATH_SEPARATOR "%s", dbdir, getargc(opt, 'b'));
     free(dbdir);
     if((oldcvd = cl_cvdhead(buffer)) == NULL)
 	mprintf("WARNING: CAN'T READ CVD HEADER OF CURRENT DATABASE %s\n", buffer);
@@ -470,6 +497,29 @@
     /* free */
 }
 
+#ifdef C_WIN32
+char *getpass(const char *prompt)
+{
+	static char pass[256];
+	int pos = 0;
+
+	for (;;) {
+		int c = getch();
+		if (c == 0 || c == 0xe0) {
+			/* chomp arrow */
+			(void)getch();
+		} else if (c == '\r' || c == '\n') {
+			pass[pos] = '\0';
+			return pass;
+		} else {
+			if (pos < sizeof(pass) - 1)
+				pass[pos++] = (char)c;
+		}
+	}
+	/* not reached */
+}
+#endif
+
 char *getdsig(const char *host, const char *user, const char *data)
 {
 	char buff[300], cmd[100], *pass, *pt;
@@ -492,7 +542,7 @@
     server.sin_port = htons(33101);
 
     if(connect(sockd, (struct sockaddr *) &server, sizeof(struct sockaddr_in)) < 0) {
-        close(sockd);
+        closesocket(sockd);
 	perror("connect()");
 	mprintf("!Can't connect to ClamAV Signing Service at %s.\n", host);
 	return NULL;
@@ -507,9 +557,9 @@
     memcpy(pt, data, 16);
     len += 16;
 
-    if(write(sockd, cmd, len) < 0) {
+    if(send(sockd, cmd, len, 0) < 0) {
 	mprintf("!Can't write to the socket.\n");
-	close(sockd);
+	closesocket(sockd);
 	memset(cmd, 0, len);
 	memset(pass, 0, strlen(pass));
 	return NULL;
@@ -519,18 +569,18 @@
     memset(pass, 0, strlen(pass));
 
     memset(buff, 0, sizeof(buff));
-    if((bread = read(sockd, buff, sizeof(buff))) > 0) {
+    if((bread = recv(sockd, buff, sizeof(buff), 0)) > 0) {
 	if(!strstr(buff, "Signature:")) {
 	    mprintf("!Signature generation error.\n");
 	    mprintf("ClamAV SDaemon: %s.\n", buff);
-	    close(sockd);
+	    closesocket(sockd);
 	    return NULL;
 	} else {
 	    mprintf("Signature received (length = %d).\n", strlen(buff) - 10);
 	}
     }
 
-    close(sockd);
+    closesocket(sockd);
     pt = buff;
     pt += 10;
     return strdup(pt);
@@ -544,7 +594,7 @@
     if(optl(opt, "unpack-current")) {
 	dbdir = freshdbdir();
 	name = mcalloc(strlen(dbdir) + strlen(getargl(opt, "unpack-current")) + 2, sizeof(char));
-	sprintf(name, "%s/%s", dbdir, getargl(opt, "unpack-current"));
+	sprintf(name, "%s" PATH_SEPARATOR "%s", dbdir, getargl(opt, "unpack-current"));
 	free(dbdir);
     } else
 	name = strdup(getargc(opt, 'u'));
@@ -560,11 +610,9 @@
 
     if(cli_untgz(fd, ".")) {
 	mprintf("!Can't unpack file.\n");
-	close(fd);
 	exit(1);
     }
 
-    close(fd);
     exit(0);
 }
 
@@ -572,7 +620,7 @@
 {
 	FILE *fd, *tmpd;
 	char *buffer, *pt, *start, *dir, *tmp;
-	int line = 0, bytes;
+	int line = 0, bytes, tmpfd;
 	const char *tmpdir;
 
 
@@ -596,17 +644,14 @@
 
 	fseek(fd, 512, SEEK_SET);
 
-	tmpdir = getenv("TMPDIR");
-	if(tmpdir == NULL)
-#ifdef P_tmpdir
-	    tmpdir = P_tmpdir;
+	tmpdir = cl_gettempdir();
+	dir = cli_gentemp(tmpdir);
+#ifdef C_WIN32
+	if(mkdir(dir)) {
 #else
-	    tmpdir = "/tmp";
+	if(mkdir(dir, 0700)) {
 #endif
-
-	dir = cli_gentemp(tmpdir);
-	if(mkdir(dir, 0700)) {
-	    mprintf("!listdb(): Can't create temporary directory %s\n", dir);
+		mprintf("!listdb(): Can't create temporary directory %s\n", dir);
 	    free(buffer);
 	    fclose(fd);
 	    return -1;
@@ -637,8 +682,12 @@
 	fflush(tmpd);
 	fseek(tmpd, 0L, SEEK_SET);
 
-	if(cli_untgz(fileno(tmpd), dir)) {
-	    mprintf("!listdb(): Can't unpack CVD file.\n");
+	tmpfd = dup(fileno(tmpd));
+	if(tmpfd == -1 || cli_untgz(tmpfd, dir)) {
+		if (tmpfd == -1)
+			mprintf("!listdb(): Can't dup an fd.\n");
+		else
+			mprintf("!listdb(): Can't unpack CVD file.\n");
 	    cli_rmdirs(dir);
 	    free(dir);
 	    fclose(tmpd);
@@ -767,7 +816,7 @@
 		    closedir(dd);
 		    return -1;
 		}
-		sprintf(dbfile, "%s/%s", dirname, dent->d_name);
+		sprintf(dbfile, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 		if(listdb(dbfile)) {
 		    mprintf("!listdb(): error listing database %s\n", dbfile);
Index: sigtool/sigtool.vcproj
===================================================================
--- sigtool/sigtool.vcproj	(.../vendor/clamav/current)	(revision 0)
+++ sigtool/sigtool.vcproj	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="sigtool"
+	ProjectGUID="{D175859E-AC75-4D90-B861-1F969CC90C63}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".,..,..\libclamav,..\shared"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="zlibD.lib ws2_32.lib pthreadVC2.lib"
+				OutputFile="$(OutDir)\$(ProjectName)D.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName)D.pdb"
+				SubSystem="1"
+				OptimizeForWindows98="1"
+				EntryPointSymbol=""
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".,..,..\libclamav,..\shared"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="zlib.lib ws2_32.lib pthreadVC2.lib"
+				OutputFile="$(OutDir)\$(ProjectName).exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				EntryPointSymbol=""
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\options.c"
+				>
+			</File>
+			<File
+				RelativePath=".\sigtool.c"
+				>
+			</File>
+			<File
+				RelativePath=".\vba.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\options.h"
+				>
+			</File>
+			<File
+				RelativePath=".\vba.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="shared"
+			>
+			<File
+				RelativePath="..\shared\cfgparser.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\cfgparser.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\getopt.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\memory.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\memory.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\misc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\misc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\output.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\output.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes on: sigtool/sigtool.vcproj
___________________________________________________________________
Name: svn:eol-style
   + CRLF

Index: sigtool/vba.c
===================================================================
--- sigtool/vba.c	(.../vendor/clamav/current)	(revision 845)
+++ sigtool/vba.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -16,17 +16,28 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <dirent.h>
 #include <clamav.h>
 #include <ctype.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#include <direct.h>
+#include <w32_dirent.h>
+#else
+#include <unistd.h>
+#include <dirent.h>
+#endif
+
 #include "../libclamav/vba_extract.h"
 #include "../libclamav/others.h"
 #include "../libclamav/cltypes.h"
@@ -966,7 +977,7 @@
 		if (strcmp (dent->d_name, ".") && strcmp (dent->d_name, "..")) {
 		    /* build the full name */
 		    fname = (char *) cli_calloc (strlen (dirname) + strlen (dent->d_name) + 2, sizeof (char));
-		    sprintf (fname, "%s/%s", dirname, dent->d_name);
+		    sprintf (fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if (lstat (fname, &statbuf) != -1) {
@@ -978,18 +989,15 @@
 			    }
 			} else {
 			    if (S_ISREG (statbuf.st_mode)) {
-				tmpdir = getenv ("TMPDIR");
+				tmpdir = cl_gettempdir();
 
-				if (tmpdir == NULL)
-#ifdef P_tmpdir
-				    tmpdir = P_tmpdir;
-#else
-				    tmpdir = "/tmp";
-#endif
-
 				/* generate the temporary directory */
 				dir = cli_gentemp (tmpdir);
+#ifdef C_WIN32
+				if (mkdir (dir)) {
+#else
 				if (mkdir (dir, 0700)) {
+#endif
 				    printf ("Can't create temporary directory %s\n", dir);
 				    return CL_ETMPDIR;
 				}
@@ -1042,7 +1050,7 @@
 
 	for (i = 0; i < vba_project->count; i++) {
 	    fullname = (char *) malloc (strlen (vba_project->dir) + strlen (vba_project->name[i]) + 2);
-	    sprintf (fullname, "%s/%s", vba_project->dir, vba_project->name[i]);
+	    sprintf (fullname, "%s" PATH_SEPARATOR "%s", vba_project->dir, vba_project->name[i]);
 	    fd = open (fullname, O_RDONLY);
 	    if (fd == -1) {
 		cli_errmsg ("Scan->OLE2 -> Can't open file %s\n", fullname);
@@ -1083,7 +1091,7 @@
     } else if ((vba_project = (vba_project_t *) wm_dir_read (dirname))) {
 	for (i = 0; i < vba_project->count; i++) {
 	    fullname = (char *) malloc (strlen (vba_project->dir) + strlen (vba_project->name[i]) + 2);
-	    sprintf (fullname, "%s/%s", vba_project->dir, vba_project->name[i]);
+	    sprintf (fullname, "%s" PATH_SEPARATOR "%s", vba_project->dir, vba_project->name[i]);
 	    fd = open (fullname, O_RDONLY);
 	    if (fd == -1) {
 		cli_errmsg ("Scan->OLE2 -> Can't open file %s\n", fullname);
@@ -1123,7 +1131,7 @@
 		if (strcmp (dent->d_name, ".") && strcmp (dent->d_name, "..")) {
 		    /* build the full name */
 		    fname = calloc (strlen (dirname) + strlen (dent->d_name) + 2, sizeof (char));
-		    sprintf (fname, "%s/%s", dirname, dent->d_name);
+		    sprintf (fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if (lstat (fname, &statbuf) != -1) {
Index: sigtool/options.c
===================================================================
--- sigtool/options.c	(.../vendor/clamav/current)	(revision 845)
+++ sigtool/options.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -32,6 +32,11 @@
 #include "memory.h"
 #include "output.h"
 
+#ifdef C_WIN32
+#include <io.h>
+#include <fcntl.h>
+#endif
+
 void sigtool(struct optstruct *opt);
 
 int main(int argc, char **argv)
@@ -63,6 +68,10 @@
 	    {0, 0, 0, 0}
     	};
 
+#ifdef C_WIN32
+	/* For the stream mode, we need stdin in binary, this is the only way to do it */
+	_setmode(0, _O_BINARY);
+#endif
 
     opt=(struct optstruct*) mcalloc(1, sizeof(struct optstruct));
     opt->optlist = NULL;
Index: clamscan/treewalk.c
===================================================================
--- clamscan/treewalk.c	(.../vendor/clamav/current)	(revision 845)
+++ clamscan/treewalk.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,13 +23,20 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <errno.h>
+
+#ifdef _WIN32
+#include <io.h>
+#include <direct.h>
+#include <w32_dirent.h>
+#else
+#include <grp.h>
+#include <unistd.h>
 #include <sys/wait.h>
-#include <grp.h>
 #include <dirent.h>
-#include <errno.h>
+#endif
 
 #include "shared.h"
 #include "manager.h"
@@ -102,7 +109,7 @@
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
 		    /* build the full name */
 		    fname = mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
-		    sprintf(fname, "%s/%s", dirname, dent->d_name);
+		    sprintf(fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if(lstat(fname, &statbuf) != -1) {
@@ -157,7 +164,7 @@
 		{
 		    if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
 			fname = mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
-			sprintf(fname, "%s/%s", dirname, dent->d_name);
+			sprintf(fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 			/* stat the file */
 			if(lstat(fname, &statbuf) != -1) {
@@ -195,6 +202,7 @@
 
 int clamav_rmdirs(const char *dir)
 {
+#ifndef _WIN32
 #ifndef C_CYGWIN
 	struct passwd *user;
 #endif
@@ -239,7 +247,9 @@
 	    else
 		return -2;
     }
-
+#else
+	return -2;
+#endif
 }
 
 int fixperms(const char *dirname)
@@ -259,7 +269,7 @@
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
 		    /* build full name */
 		    fname = mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
-		    sprintf(fname, "%s/%s", dirname, dent->d_name);
+		    sprintf(fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if(lstat(fname, &statbuf) != -1) {
@@ -307,7 +317,7 @@
 
 		    /* build the full name */
 		    fname = mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
-		    sprintf(fname, "%s/%s", dirname, dent->d_name);
+		    sprintf(fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if(lstat(fname, &statbuf) != -1) {
Index: clamscan/manager.h
===================================================================
--- clamscan/manager.h	(.../vendor/clamav/current)	(revision 845)
+++ clamscan/manager.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -20,9 +20,13 @@
 #define __MANAGER_H
 
 #include <clamav.h>
-#include <pwd.h>
 #include "options.h"
 
+#ifdef _WIN32
+#else
+#include <pwd.h>
+#endif
+
 int scanmanager(const struct optstruct *opt);
 
 int scanfile(const char *filename, struct cl_node *root, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options);
Index: clamscan/clamscan.c
===================================================================
--- clamscan/clamscan.c	(.../vendor/clamav/current)	(revision 845)
+++ clamscan/clamscan.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,9 +23,16 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#include <direct.h>
+#include <w32_time.h>
+#else
 #include <unistd.h>
 #include <sys/time.h>
-#include <time.h>
+#endif
 
 #include "options.h"
 #include "others.h"
Index: clamscan/clamscan.vcproj
===================================================================
--- clamscan/clamscan.vcproj	(.../vendor/clamav/current)	(revision 0)
+++ clamscan/clamscan.vcproj	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,295 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="clamscan"
+	ProjectGUID="{788F16FB-BCDC-42FC-9523-E1A927A15A52}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".,..,..\libclamav,..\shared"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				ForceConformanceInForLoopScope="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="zlibD.lib ws2_32.lib pthreadVC2.lib"
+				OutputFile="$(OutDir)\$(ProjectName)D.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName)D.pdb"
+				SubSystem="1"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				AdditionalIncludeDirectories=".,..,..\libclamav,..\shared"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				ForceConformanceInForLoopScope="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="zlib.lib ws2_32.lib pthreadVC2.lib"
+				OutputFile="$(OutDir)\$(ProjectName).exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\clamscan.c"
+				>
+			</File>
+			<File
+				RelativePath=".\manager.c"
+				>
+			</File>
+			<File
+				RelativePath=".\options.c"
+				>
+			</File>
+			<File
+				RelativePath=".\others.c"
+				>
+			</File>
+			<File
+				RelativePath=".\treewalk.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\defaults.h"
+				>
+			</File>
+			<File
+				RelativePath=".\manager.h"
+				>
+			</File>
+			<File
+				RelativePath=".\options.h"
+				>
+			</File>
+			<File
+				RelativePath=".\others.h"
+				>
+			</File>
+			<File
+				RelativePath=".\shared.h"
+				>
+			</File>
+			<File
+				RelativePath=".\treewalk.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="shared"
+			>
+			<File
+				RelativePath="..\shared\cfgparser.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\cfgparser.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\getopt.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\memory.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\memory.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\misc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\misc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\output.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\output.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes on: clamscan/clamscan.vcproj
___________________________________________________________________
Name: svn:eol-style
   + CRLF

Index: clamscan/treewalk.h
===================================================================
--- clamscan/treewalk.h	(.../vendor/clamav/current)	(revision 845)
+++ clamscan/treewalk.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -19,9 +19,13 @@
 #ifndef __TREEWALK_H
 #define __TREEWALK_H
 
-#include <pwd.h>
 #include <clamav.h>
 
+#ifdef _WIN32
+#else
+#include <pwd.h>
+#endif
+
 #include "options.h"
 
 struct s_du {
Index: clamscan/others.c
===================================================================
--- clamscan/others.c	(.../vendor/clamav/current)	(revision 845)
+++ clamscan/others.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -28,18 +28,24 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include <unistd.h>
 #include <errno.h>
-#include <pwd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/time.h>
 #include <time.h>
 #include <fcntl.h>
-#include <signal.h>
 #include <target.h>
 
+#ifdef _WIN32
+#include <io.h>
+#include <windows.h>
+#else
+#include <pwd.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <sys/time.h>
+#include <signal.h>
+#endif
+
 #ifdef HAVE_REGEX_H
 #include <regex.h>
 #endif
@@ -51,6 +57,37 @@
 {
 	struct stat infostruct;
 
+#ifdef C_WIN32
+	char statname[MAX_PATH];
+	size_t len = strlen(filename);
+
+	if (len == 2 && filename[1] == ':') {
+		strcpy(statname, filename);
+		strcat(statname, ".");
+		filename = statname;
+	} else if (len > 0 && (filename[len - 1] == '\\' || filename[len - 1] == '/')) {		
+		if (filename[len - 1] == '/') {
+			if (len >= MAX_PATH) {
+				errno = EINVAL;
+				return -1;
+			}
+			strcpy(statname, filename);
+			statname[len - 1] = '\\';
+			if (!(len == 3 && statname[1] == ':'))
+				statname[--len] = '\0';
+			filename = statname;
+		} else if (!(len == 3 && filename[1] == ':')) {
+			if (len >= MAX_PATH) {
+				errno = EINVAL;
+				return -1;
+			}
+			strcpy(statname, filename);
+			statname[--len] = '\0';
+			filename = statname;
+		}
+	}
+#endif
+
     if(stat(filename, &infostruct) == -1)
 	return(-1);
 
@@ -59,7 +96,7 @@
 	case 1: /* size */
 	    return infostruct.st_size;
 	case 2: /* permissions */
-	    return (mode_t)infostruct.st_mode;
+	    return (int)infostruct.st_mode;
 	case 3: /* modification time */
 	    return infostruct.st_mtime;
 	case 4: /* UID */
@@ -74,6 +111,7 @@
 
 int checkaccess(const char *path, const char *username, int mode)
 {
+#if !defined(C_WIN32)
 	struct passwd *user;
 	int ret = 0, status;
 
@@ -113,8 +151,12 @@
 	if(!access(path, mode))
 	    ret = 1;
     }
-
     return ret;
+#else
+	if(!access(path, mode))
+	    return 1;
+	return 0;
+#endif
 }
 
 int match_regex(const char *filename, const char *pattern)
Index: clamscan/manager.c
===================================================================
--- clamscan/manager.c	(.../vendor/clamav/current)	(revision 845)
+++ clamscan/manager.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -29,16 +29,25 @@
 #include <ctype.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <sys/wait.h>
-#include <utime.h>
-#include <grp.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <sys/types.h>
 #include <signal.h>
 #include <clamav.h>
 #include <errno.h>
 
+#ifdef _WIN32
+#include <io.h>
+#include <direct.h>
+#include <process.h>
+#include <sys/utime.h>
+#include <windows.h>
+#else
+#include <unistd.h>
+#include <sys/wait.h>
+#include <grp.h>
+#include <utime.h>
+#endif
+
 #include "defaults.h"
 #include "others.h"
 #include "options.h"
@@ -60,7 +69,7 @@
 int scanmanager(const struct optstruct *opt)
 {
 	mode_t fmode;
-	int ret = 0, compression = 0, fmodeint, options = 0, i, x;
+	int i, ret = 0, compression = 0, fmodeint, options = 0, x;
 	struct cl_node *trie = NULL;
 	struct cl_limits *limits = NULL;
 	struct passwd *user = NULL;
@@ -69,7 +78,7 @@
 
 
 /* njh@bandsman.co.uk: BeOS */
-#if !defined(C_CYGWIN) && !defined(C_OS2) && !defined(C_BEOS)
+#if !defined(C_CYGWIN) && !defined(C_OS2) && !defined(C_BEOS) && !defined(C_WIN32)
     if(!geteuid()) {
 	if((user = getpwnam(UNPUSER)) == NULL) {
 	    mprintf("@Can't get information about user "UNPUSER"\n");
@@ -134,7 +143,7 @@
     if(optl(opt, "max-space")) {
 	char *cpy, *ptr;
 	ptr = getargl(opt, "max-space");
-	if(tolower(ptr[strlen(ptr) - 1]) == 'm') {
+	if(tolower((unsigned char)ptr[strlen(ptr) - 1]) == 'm') {
 	    cpy = mcalloc(strlen(ptr), sizeof(char));
 	    strncpy(cpy, ptr, strlen(ptr) - 1);
 	    limits->maxfilesize = atoi(cpy) * 1024 * 1024;
@@ -225,6 +234,19 @@
     } else {
 	char *thefilename;
 	for (x = 0; (thefilename = cli_strtok(opt->filename, x, "\t")) != NULL; x++) {
+#ifdef C_WIN32
+		/* use API, fullpath is more complicated than has '/' on win32 due to drive letters */
+		if (_fullpath(cwd, thefilename, sizeof(cwd)) == NULL ||
+			(fmodeint = fileinfo(thefilename, 2)) == -1) {
+			mprintf("@Can't access file %s\n", thefilename);
+			perror(thefilename);
+			ret = 56;
+		} else {
+			fullpath = cwd;
+			i = strlen(fullpath);
+			fmode = (mode_t)fmodeint;
+#else
+
 	    if((fmodeint = fileinfo(thefilename, 2)) == -1) {
 		mprintf("@Can't access file %s\n", thefilename);
 		perror(thefilename);
@@ -232,15 +254,14 @@
 	    } else {
 		int slash = 1;
 		for(i = strlen(thefilename) - 1; i > 0 && slash; i--) {
-		    if(thefilename[i] == '/')
+			if (thefilename[i] == '/')
 			thefilename[i] = 0;
 		    else
 			slash = 0;
 		}
 
 		fmode = (mode_t) fmodeint;
-
-		if(compression && (thefilename[0] != '/' && thefilename[0] != '\\' && thefilename[1] != ':')) {
+		if(compression && thefilename[0] != '/') {
 		    /* we need to complete the path */
 		    if(!getcwd(cwd, sizeof(cwd))) {
 			mprintf("@Can't get absolute pathname of current working directory\n");
@@ -249,14 +270,15 @@
 		    } else {
 			fullpath = mcalloc(512, sizeof(char));
 #ifdef NO_SNPRINTF
-			sprintf(fullpath, "%s/%s", cwd, thefilename);
+			sprintf(fullpath, "%s" PATH_SEPARATOR "%s", cwd, thefilename);
 #else
-			snprintf(fullpath, 512, "%s/%s", cwd, thefilename);
+			snprintf(fullpath, 512, "%s" PATH_SEPARATOR "%s", cwd, thefilename);
 #endif
 			mprintf("*Full path: %s\n", fullpath);
 		    }
 		} else
 		    fullpath = thefilename;
+#endif
 
 		switch(fmode & S_IFMT) {
 		    case S_IFREG:
@@ -272,10 +294,12 @@
 			ret = 52;
 		}
 
-		if(compression && (thefilename[0] != '/' && thefilename[0] != '\\' && thefilename[1] != ':')) {
+#ifndef C_WIN32
+		if(compression && thefilename[0] != '/') {
 		    free(fullpath);
 		    fullpath = NULL;
 		}
+#endif
 	    }
 	    free(thefilename);
 	}
@@ -349,7 +373,9 @@
 	return 0;
     }
 
+#if !defined(C_WIN32)
     if(geteuid())
+#endif
 	if(checkaccess(filename, NULL, R_OK) != 1) {
 	    if(!printinfected)
 		mprintf("%s: Access denied\n", filename);
@@ -413,13 +439,17 @@
 		mprintf("@Can't fork\n");
 		exit(61);
 	    case 0: /* read access denied */
+#if !defined(C_WIN32)
 		if(geteuid()) {
 		    if(!printinfected)
 			mprintf("%s: Access denied to archive\n", filename);
 		} else {
+#else
+			{
+#endif
 
 		    if(limits && limits->maxfilesize)
-			if(fileinfo(filename, 1) / 1024 > limits->maxfilesize) {
+			if((unsigned int)fileinfo(filename, 1) / 1024 > limits->maxfilesize) {
 			    if(!printinfected)
 				mprintf("%s: Archive too big\n", filename);
 			    return 0;
@@ -453,7 +483,8 @@
 int scancompressed(const char *filename, struct cl_node *root, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options)
 {
 	int ret = 0;
-	char *tmpdir, *gendir, *userprg;
+	const char *tmpdir;
+	char *gendir, *userprg;
 	struct stat statbuf;
 
 
@@ -466,15 +497,8 @@
 
     /* check write access */
 
-    tmpdir = getenv("TMPDIR");
+    tmpdir = cl_gettempdir();
 
-    if(tmpdir == NULL)
-#ifdef P_tmpdir
-	tmpdir = P_tmpdir;
-#else
-	tmpdir = "/tmp";
-#endif
-
     if(checkaccess(tmpdir, UNPUSER, W_OK) != 1) {
 	mprintf("@Can't write to the temporary directory\n");
 	exit(64);
@@ -483,12 +507,16 @@
     /* generate the temporary directory */
 
     gendir = cli_gentemp(tmpdir);
+#ifdef _WIN32
+    if(mkdir(gendir)) {
+#else
     if(mkdir(gendir, 0700)) {
+#endif
 	mprintf("@Can't create the temporary directory %s\n", gendir);
 	exit(63); /* critical */
     }
 
-#ifndef C_OS2
+#if !defined(C_OS2) && !defined(C_WIN32)
     if(user)
 	chown(gendir, user->pw_uid, user->pw_gid);
 #endif
@@ -659,7 +687,8 @@
 
 int scandenied(const char *filename, struct cl_node *root, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options)
 {
-	char *tmpdir, *gendir, *tmpfile, *pt;
+	const char *tmpdir;
+	char *gendir, *tmpfile, *pt;
 	struct stat statbuf;
 	int ret;
 
@@ -671,16 +700,8 @@
 
     /* check write access */
 
-    tmpdir = getenv("TMPDIR");
+    tmpdir = cl_gettempdir();
 
-    if(tmpdir == NULL)
-#ifdef P_tmpdir
-	tmpdir = P_tmpdir;
-#else
-	tmpdir = "/tmp";
-#endif
-
-
     if(checkaccess(tmpdir, UNPUSER, W_OK) != 1) {
 	mprintf("@Can't write to the temporary directory %s\n", tmpdir);
 	exit(64);
@@ -688,19 +709,27 @@
 
     /* generate the temporary directory */
     gendir = cli_gentemp(tmpdir);
+#ifdef C_WIN32
+    if(mkdir(gendir)) {
+#else
     if(mkdir(gendir, 0700)) {
+#endif
 	mprintf("@Can't create the temporary directory %s\n", gendir);
 	exit(63); /* critical */
     }
 
     tmpfile = (char *) mcalloc(strlen(gendir) + strlen(filename) + 10, sizeof(char));
     pt = strrchr(filename, '/');
+#ifdef C_WIN32
+	if (!pt)
+		pt = strrchr(filename, '//');
+#endif
     if(!pt)
 	pt = (char *) filename;
     else
 	pt += 1;
 
-    sprintf(tmpfile, "%s/%s", gendir, pt);
+    sprintf(tmpfile, "%s" PATH_SEPARATOR "%s", gendir, pt);
 
     if(filecopy(filename, tmpfile) == -1) {
 	mprintf("!I/O error\n");
@@ -710,7 +739,7 @@
 
     fixperms(gendir);
 
-#ifndef C_OS2
+#if !defined(C_OS2) && !defined(C_WIN32)
     if(user) {
 	chown(gendir, user->pw_uid, user->pw_gid);
 	chown(tmpfile, user->pw_uid, user->pw_gid);
@@ -756,7 +785,7 @@
 
     mprintf("*Scanning %s\n", filename);
 
-    if((fd = open(filename, O_RDONLY)) == -1) {
+    if((fd = open(filename, O_BINARY|O_RDONLY)) == -1) {
 	mprintf("@Can't open file %s\n", filename);
 	return 54;
     }
@@ -789,15 +818,8 @@
 
 
     /* check write access */
-    tmpdir = getenv("TMPDIR");
+    tmpdir = cl_gettempdir();
 
-    if(tmpdir == NULL)
-#ifdef P_tmpdir
-	tmpdir = P_tmpdir;
-#else
-	tmpdir = "/tmp";
-#endif
-
     if(checkaccess(tmpdir, UNPUSER, W_OK) != 1) {
 	mprintf("@Can't write to temporary directory\n");
 	return 64;
@@ -844,8 +866,108 @@
  * 0 -> OK
  */
 
+#ifdef C_WIN32
 int clamav_unpack(const char *prog, char **args, const char *tmpdir, const struct passwd *user, const struct optstruct *opt)
 {
+	int status, ret = 0, maxfiles, maxspace, fdevnull = -1, fdstdout = -1, fdstderr = -1;
+	intptr_t phandle;
+	struct s_du n;
+	char curdir[MAX_PATH];
+
+    if(optl(opt, "max-files"))
+	maxfiles = atoi(getargl(opt, "max-files"));
+    else
+	maxfiles = 0;
+
+    if(optl(opt, "max-space")) {
+	    char *cpy, *ptr;
+	ptr = getargl(opt, "max-space");
+	if(tolower((unsigned char)ptr[strlen(ptr) - 1]) == 'm') { /* megabytes */
+	    cpy = mcalloc(strlen(ptr), sizeof(char));
+	    strncpy(cpy, ptr, strlen(ptr) - 1);
+	    maxspace = atoi(cpy) * 1024;
+	    free(cpy);
+	} else /* default - kilobytes */
+	    maxspace = atoi(ptr);
+    } else
+	maxspace = 0;
+
+	getcwd(curdir, MAX_PATH);
+    chdir(tmpdir);
+
+	if(printinfected) {
+		fdevnull = open("NUL", O_BINARY|O_WRONLY);
+		if(fdevnull == -1) {
+			mprintf("Non fatal error: cannot open NUL. Continuing with full output\n");
+			printinfected = 0;
+		} else {
+			fdstdout = dup(1);
+			fdstderr = dup(2);
+			dup2(fdevnull,1);
+			dup2(fdevnull,2);
+		}
+	}
+
+	if(strchr(prog, '\\')) /* we have full path */
+		phandle = spawnv(P_NOWAIT, prog, args);
+	else
+		phandle = spawnvp(P_NOWAIT, prog, args);
+	if (phandle == -1) {
+		ret = -2;
+	} else {
+		if(maxfiles || maxspace) {
+			/* Have to use WFSO to get a timeout, no CRT equivalent exists */
+			int done = 0;
+			DWORD exitCode = 9;
+
+			while (!done)
+			{
+				switch (WaitForSingleObject((HANDLE)phandle, 0))
+				{
+				case WAIT_TIMEOUT:
+					memset(&n, 0, sizeof(struct s_du));
+					if(!du(tmpdir, &n))
+						if((maxfiles && n.files > maxfiles) || (maxspace && n.space > maxspace)) {
+							mprintf("*n.files: %d, n.space: %d\n", n.files, n.space);
+							TerminateProcess((HANDLE)phandle, 255);
+						}
+					break;
+				case WAIT_OBJECT_0:
+					done = 1;
+					break;
+				}
+			}
+			(void)GetExitCodeProcess((HANDLE)phandle, &exitCode);
+			status = (int)exitCode;
+			CloseHandle((HANDLE)phandle);
+		} else
+			_cwait(&status, phandle, _WAIT_CHILD);
+
+		switch (status)
+		{
+		case 255:
+			mprintf("\nUnpacker process stopped due to exceeded limits\n");
+			ret = 0;
+			break;
+		}
+	}
+
+	if (fdstdout != -1) {
+		dup2(fdstdout,1);
+		close(fdstdout);
+	}
+	if (fdstderr != -1) {
+		dup2(fdstderr,2);
+		close(fdstderr);
+	}
+	if (fdevnull != -1)
+		close(fdevnull);
+
+	return ret;
+}
+#else
+int clamav_unpack(const char *prog, char **args, const char *tmpdir, const struct passwd *user, const struct optstruct *opt)
+{
 	pid_t pid;
 	int status, wret, maxfiles, maxspace, fdevnull;
 	struct s_du n;
@@ -859,7 +981,7 @@
     if(optl(opt, "max-space")) {
 	    char *cpy, *ptr;
 	ptr = getargl(opt, "max-space");
-	if(tolower(ptr[strlen(ptr) - 1]) == 'm') { /* megabytes */
+	if(tolower((unsigned char)ptr[strlen(ptr) - 1]) == 'm') { /* megabytes */
 	    cpy = mcalloc(strlen(ptr), sizeof(char));
 	    strncpy(cpy, ptr, strlen(ptr) - 1);
 	    maxspace = atoi(cpy) * 1024;
@@ -898,7 +1020,7 @@
 	    chdir(tmpdir);
 
 	    if(printinfected) {
-  	        fdevnull = open("/dev/null", O_WRONLY);
+  	        fdevnull = open("/dev/null", O_BINARY|O_WRONLY);
 		if(fdevnull == -1) {
 		    mprintf("Non fatal error: cannot open /dev/null. Continuing with full output\n");
 		    printinfected = 0;
@@ -950,6 +1072,7 @@
 
     return 0;
 }
+#endif
 
 void move_infected(const char *filename, const struct optstruct *opt)
 {
@@ -972,6 +1095,9 @@
         return;
     }
 
+#ifdef C_WIN32
+    if(!(tmp = strrchr(filename, '\\')))
+#endif
     if(!(tmp = strrchr(filename, '/')))
 	tmp = (char *) filename;
 
@@ -989,7 +1115,7 @@
         return;
     }
 
-    strcat(movefilename, "/");
+    strcat(movefilename, PATH_SEPARATOR);
 
     if(!(strcat(movefilename, tmp))) {
         mprintf("@strcat() returned NULL\n");
@@ -1001,6 +1127,7 @@
     stat(filename, &fstat);
 
     if(!stat(movefilename, &mfstat)) {
+#ifndef C_WIN32
         if(fstat.st_ino == mfstat.st_ino) { /* It's the same file*/
             mprintf("File excluded '%s'\n", filename);
             logg("File excluded '%s'\n", filename);
@@ -1008,6 +1135,9 @@
             free(movefilename);
             return;
         } else {
+#else
+		{
+#endif
             /* file exists - try to append an ordinal number to the
 	     * quranatined file in an attempt not to overwrite existing
 	     * files in quarantine  
@@ -1035,7 +1165,7 @@
 	}
 
 	chmod(movefilename, fstat.st_mode);
-#ifndef C_OS2
+#if !defined(C_OS2) && !defined(C_WIN32)
 	chown(movefilename, fstat.st_uid, fstat.st_gid);
 #endif
 
Index: clamscan/options.c
===================================================================
--- clamscan/options.c	(.../vendor/clamav/current)	(revision 845)
+++ clamscan/options.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -30,6 +30,9 @@
 #define _GNU_SOURCE
 #include "getopt.h"
 
+#ifdef C_WIN32
+#include <windows.h>
+#endif
 
 #include "options.h"
 #include "shared.h"
@@ -117,7 +120,17 @@
 	    {0, 0, 0, 0}
     	};
 
+#if defined(C_WIN32)
+	WSADATA wsa;
 
+	ZeroMemory(&wsa, sizeof(wsa));
+	ret = WSAStartup(MAKEWORD(1, 1), &wsa);
+	if (ret != 0) {
+		mprintf("WSAStartup failed with %d\n", ret);
+		return 56;
+	}
+#endif
+
     opt=(struct optstruct*) mcalloc(1, sizeof(struct optstruct));
     opt->optlist = NULL;
 
Index: ClamAVSetup/binary/removico.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/removico.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/Up.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/Up.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/exclamic.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/exclamic.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/dlgbmp.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/dlgbmp.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/insticon.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/insticon.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/custicon.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/custicon.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/New.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/New.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/info.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/info.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/completi.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/completi.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/repairic.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/repairic.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/bannrbmp.ibd
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: ClamAVSetup/binary/bannrbmp.ibd
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: ClamAVSetup/binary/GPL.rtf
===================================================================
--- ClamAVSetup/binary/GPL.rtf	(.../vendor/clamav/current)	(revision 0)
+++ ClamAVSetup/binary/GPL.rtf	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,67 @@
+{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fcharset0 Arial;}}
+{\stylesheet{ Normal;}{\s1 heading 1;}{\s2 heading 2;}}
+{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\s2\sb100\sa100\b\f0\fs24 ClamAV - an AntiVirus scanner\par
+\b0\fs20 Copyright (C) 2002 - 2005 Tomasz Kojm <tkojm@clamav.net>\par
+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 of the License, or (at your option) any later version.\par
+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\par
+You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\par
+\b\fs24\par
+GNU GENERAL PUBLIC LICENSE\par
+\pard\sb100\sa100\b0\fs20 Version 2, June 1991 \par
+\pard Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\fs24  \par
+\pard\s2\sb100\sa100\b Preamble\par
+\pard\sb100\sa100\b0\fs20 The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. \par
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. \par
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. \par
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. \par
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. \par
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. \par
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. \par
+The precise terms and conditions for copying, distribution and modification follow.\fs24  \par
+\pard\s2\sb100\sa100\b TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\par
+\pard\sb100\sa100\b0\fs20 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". \par
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. \par
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. \par
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. \par
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: \par
+\pard\fi-360\li720\sb100\sa100\tx720\f1\'b7\tab\f0 a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. \par
+\pard\fi-360\li720\sb100\sa100\f1\'b7\tab\f0 b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. \par
+\f1\'b7\tab\f0 c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) \par
+\pard These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. \par
+\pard\sb100\sa100 Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. \par
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. \par
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: \par
+\pard\fi-360\li720\sb100\sa100\tx720\f1\'b7\tab\f0 a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \par
+\pard\fi-360\li720\sb100\sa100\f1\'b7\tab\f0 b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \par
+\f1\'b7\tab\f0 c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) \par
+\pard The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. \par
+\pard\sb100\sa100 If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. \par
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. \par
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. \par
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. \par
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. \par
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. \par
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. \par
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. \par
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. \par
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. \par
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. \par
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. \par
+NO WARRANTY \par
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. \par
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. \par
+\pard\s2\sb100\sa100\b\fs24 END OF TERMS AND CONDITIONS \par
+How to Apply These Terms to Your New Programs\fs20\par
+\pard\sb100\sa100\b0 If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. \par
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. \par
+\pard one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author 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 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. \par
+\pard\sb100\sa100 Also add information on how to contact you by electronic and paper mail. \par
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode: \par
+\pard Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. \par
+\pard\sb100\sa100 The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c' ; they could even be mouse-clicks or menu items--whatever suits your program. \par
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: \par
+\pard Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. signature of Ty Coon , 1 April 1989 Ty Coon, President of Vice \par
+\pard\sb100\sa100 This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.\par
+\pard\f2\par
+}
+ 
\ No newline at end of file
Index: ClamAVSetup/ClamAVSetup.wxs
===================================================================
--- ClamAVSetup/ClamAVSetup.wxs	(.../vendor/clamav/current)	(revision 0)
+++ ClamAVSetup/ClamAVSetup.wxs	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,1328 @@
+<?xml version="1.0"?>
+<!-- 
+	Copyright (C) 2005 Mark Weaver <mark@npsl.co.uk>
+
+	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 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+-->
+<Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
+
+	<Product Id="9C096C6F-EA43-4CCB-9244-03DAE8859E17" Name="ClamAV" Language="1033" Version="1.0.0.0" Manufacturer="Clam AntiVirus development team."
+		UpgradeCode="19AEE25B-E2E9-4783-BB71-AB29A9F7D3F8">
+		<Package Id="????????-????-????-????-????????????" Description="Clam AntiVirus" 
+			Comments="This will appear in the file summary stream." InstallerVersion="200" Compressed="yes" />
+
+		<Media Id="1" Cabinet="Product.cab" EmbedCab="yes" />
+
+		<CustomAction Id="GenerateConfFiles" BinaryKey="w32confgen"
+					Execute="deferred" Impersonate="yes" ExeCommand=""/>
+		<Binary Id="w32confgen" src="..\bin\w32confgen.exe"/>
+
+		<Directory Id="TARGETDIR" Name="SourceDir">
+
+			<Directory Id="ProgramFilesFolder">
+				<Directory Id="INSTALLLOCATION" Name="ClamAV">
+
+					<Directory Id="BIN" Name="bin">
+						<Merge Id="CRT" Language="0" src="C:\Program Files\Common Files\Merge Modules\microsoft_vc80_crt_x86.msm" DiskId="1" />
+						<Merge Id="CRT Policy" Language="0" src="C:\Program Files\Common Files\Merge Modules\policy_8_0_Microsoft_VC80_CRT_x86.msm" DiskId="1" />
+						
+						<Component Id="clamd" Guid="5C1C5EE3-086F-4132-AC0C-D69DC5B58BB6">
+							<ServiceInstall Id="clamd" Arguments="--service" 
+								Description="Provides virus scanning services for the local machine."
+								DisplayName="Clam AntiVirus Scanner Service"
+								Name="clamd"
+								Start="auto"
+								ErrorControl="normal"
+								Type="ownProcess"
+								/>
+							<ServiceControl Id="ctl_clamd" Name="clamd" Remove="uninstall" Start="install" Stop="uninstall" Wait="yes"/>
+							<File DiskId="1" Id="clamd" Name="CLAMD.EXE" LongName="clamd.exe" src="..\bin\clamd.exe"/>
+							<File DiskId="1" Id="clamd_pdb" Name="CLAMD.PDB" LongName="clamd.pdb" src="..\bin\clamd.pdb"/>
+						</Component>
+
+						<Component Id="clamdscan" Guid="9B8F9584-6CAF-42F5-8045-6D9532B68B8E">
+							<File DiskId="1" Id="clamdscan" Name="CLAMDS~1.EXE" LongName="clamdscan.exe" src="..\bin\clamdscan.exe"/>
+							<File DiskId="1" Id="clamdscan_pdb" Name="CLAMDS~1.PDB" LongName="clamdscan.pdb" src="..\bin\clamdscan.pdb"/>
+						</Component>
+						
+						<Component Id="clamscan" Guid="234182AF-2270-46F5-97F8-81948C30C754">
+							<File DiskId="1" Id="clamscan" Name="CLAMSCAN.EXE" LongName="clamscan.exe" src="..\bin\clamscan.exe"/>
+							<File DiskId="1" Id="clamscan_pdb" Name="CLAMSCAN.PDB" LongName="clamscan.pdb" src="..\bin\clamscan.pdb"/>
+						</Component>					
+
+						<Component Id="freshclam" Guid="EC674531-17A1-4FC8-89E6-41063B687B58">
+							<ServiceInstall Id="freshclam" Arguments="--service" 
+								Description="Automatically keeps the virus scanning database up to date, downloading new versions as they become available."
+								DisplayName="Clam AntiVirus Update Service"
+								Name="freshclam"
+								Start="auto"
+								ErrorControl="normal"
+								Type="ownProcess"
+								/>
+							<ServiceControl Id="ctl_freshclam" Name="freshclam" Remove="uninstall" Start="install" Stop="uninstall" Wait="yes"/>
+							<File DiskId="1" Id="freshclam" Name="FRESHC~1.DLL" LongName="freshclam.exe" src="..\bin\freshclam.exe"/>
+							<File DiskId="1" Id="freshclam_pdb" Name="FRESHC~1.PDB" LongName="freshclam.pdb" src="..\bin\freshclam.pdb"/>
+						</Component>  
+						
+						<Component Id="libclamav" Guid="DEEFBE4B-E73F-4CFE-9A76-6E3E37B74F6A">
+							<File DiskId="1" Id="libclamav" Name="LIBCLA~1.DLL" LongName="libclamav.dll" src="..\bin\libclamav.dll"/>
+							<File DiskId="1" Id="libclamav_pdb" Name="LIBCLA~1.PDB" LongName="libclamav.pdb" src="..\bin\libclamav.pdb"/>
+						</Component>
+						
+						<Component Id="sigtool" Guid="62AE2CB0-9CBE-4483-86D0-15A131D92BDE">
+							<File DiskId="1" Id="sigtool" Name="SIGTOO~1.EXE" LongName="sigtool.exe" src="..\bin\sigtool.exe"/>
+							<File DiskId="1" Id="sigtool_pdb" Name="SIGTOO~1.PDB" LongName="sigtool.pdb" src="..\bin\sigtool.pdb"/>
+						</Component>
+						
+						<Component Id="pthreadVC2" Guid="BABEC862-2E0A-4E6E-8019-FCFA633A407E">
+							<File DiskId="1" Id="pthreadVC2" Name="pthrea~1.dll" LongName="pthreadVC2.dll" src="\utils\pthreadVC2.dll"/>
+						</Component>
+						
+						<Component Id="zlib" Guid="388C0B57-C2DA-440A-9AA2-9EAA969EAF26">
+							<File DiskId="1" Id="zlib" Name="ZLIB.DLL" LongName="zlib.dll" src="\utils\zlib.dll"/>
+						</Component>
+						
+						<Component Id="libbz2" Guid="EC817E3E-5535-497F-B97A-E903A30DCDD2">
+							<File DiskId="1" Id="libbz2" Name="LIBBZ2.DLL" LongName="libbz2.dll" src="\utils\libbz2.dll"/>
+						</Component>
+						
+						<Component Id="gmp" Guid="1678FE9A-57C1-4B81-AF4E-F41DD239414C">
+							<File DiskId="1" Id="gmp" Name="GMP.DLL" LongName="gmp.dll" src="\utils\gmp.dll"/>
+						</Component>
+
+						<Component Id="msvcr71" Guid="53BE1490-04B7-4386-8FF8-68246C5FAE41">
+							<File DiskId="1" Id="msvcr71" Name="MSVCR71.DLL" LongName="msvcr71.dll" KeyPath="yes" src="c:\windows\system32\msvcr71.dll" />
+						</Component>
+					</Directory>
+
+					<Directory Id="TEST" Name="test">
+						<Component Id="test_clam_error.rar" Guid="5E8FEDA6-7C19-4D74-ADE3-7221B37DE75C">
+							<File DiskId="1" Id="clam_error.rar" Name="CLAM-E~1.RAR" LongName="clam-error.rar" src="..\test\clam-error.rar"/>
+						</Component>
+
+						<Component Id="test_clam.cab" Guid="4DF7E4CA-5B8F-4340-BAA2-2395A0FB6A0D">
+							<File DiskId="1" Id="clam.cab" Name="CLAM.CAB" LongName="clam.cab" src="..\test\clam.cab"/>
+						</Component>
+
+						<Component Id="test_clam.exe" Guid="4C741C9C-FD59-4666-B3E5-9A648D76D38F">
+							<File DiskId="1" Id="clam.exe" Name="CLAM.EXE" LongName="clam.exe" src="..\test\clam.exe"/>
+						</Component>
+
+						<Component Id="test_clam.exe.bz2" Guid="867B6A4F-DDC8-436B-82C3-CE4FCC88C42F">
+							<File DiskId="1" Id="clam.exe.bz" Name="CLAMEX~1.BZ2" LongName="clam.exe.bz2" src="..\test\clam.exe.bz2"/>
+						</Component>
+
+						<Component Id="test_clam.rar" Guid="B39BF2A6-FB2B-46CB-BB87-CA02E17F4F3D">
+							<File DiskId="1" Id="clam.rar" Name="CLAM.RAR" LongName="clam.rar" src="..\test\clam.rar"/>
+						</Component>
+
+						<Component Id="test_clam.zip" Guid="D42B1244-FD92-4045-8DCF-5791FFE27086">
+							<File DiskId="1" Id="clam.zip" Name="CLAM.ZIP" LongName="clam.zip" src="..\test\clam.zip"/>
+						</Component>
+
+						<Component Id="test_README" Guid="41EA6118-6F43-4C73-9BA2-AA3897FA4B02">
+							<File DiskId="1" Id="README" Name="README" LongName="README" src="..\test\README"/>
+						</Component>
+					</Directory>
+					
+					<Directory Id="DB" Name="db">
+						<Component Id="db_daily_cvd" Guid="8CF3DA0E-F75F-4010-BDA2-DDCDCF700E2D">
+							<Registry Root="HKLM" Key="Software\ClamAV" Name="DataDir" Value="[DB]" Id="regDataDir" Type="string"/>
+							<File DiskId="1" Id="db_daily_cvd" Name="DAILY.CVD" LongName="daily.cvd" src="..\db\daily.cvd"/>
+						</Component>
+						<Component Id="db_main_cvd" Guid="9928553C-6F69-464F-A302-6D6B3E3B1BFD">
+							<File DiskId="1" Id="db_main_cvd" Name="MAIN.CVD" LongName="main.cvd" src="..\db\main.cvd"/>
+						</Component>
+					</Directory>
+
+					<Directory Id="LOG" Name="log">
+						<Component Id="log" Guid="8716362C-F4CE-49DD-8C52-A53BFE719189">
+							<Registry Root="HKLM" Key="Software\ClamAV" Name="LogDir" Value="[LOG]" Id="regLogDir" Type="string"/>
+							<RemoveFile Id="logClean" Name="*.*" On="uninstall"/>
+							<CreateFolder/>
+							<RemoveFolder Id="logDirClean" Directory="LOG" On="uninstall"/>
+						</Component>
+					</Directory>
+					
+					<Directory Id="CONF" Name="conf">
+						<Component Id="conf" Guid="109AAB10-E19E-4830-BF69-2009F71C4C8A">
+							<Registry Root="HKLM" Key="Software\ClamAV" Name="ConfDir" Value="[CONF]" Id="regConfDir" Type="string"/>
+							<RemoveFile Id="confClean" Name="*.*" On="uninstall"/>
+							<CreateFolder/>
+							<RemoveFolder Id="confDirClean" Directory="CONF" On="uninstall"/>
+						</Component>
+					</Directory>
+					
+				</Directory>
+
+			</Directory>
+		</Directory>
+
+		
+		<Feature Id="ClamAV" Level="1" ConfigurableDirectory="INSTALLLOCATION" Title="ClamAV" Description="The complete package">
+			<Feature Id="CoreLibraries" Title="Core Libraries" Level="1" Description="Core libraries required by all components">
+				<MergeRef Id="CRT" />
+				<MergeRef Id="CRT Policy" />
+				<ComponentRef Id="libclamav"/>
+				<ComponentRef Id="pthreadVC2"/>
+				<ComponentRef Id="zlib"/>
+				<ComponentRef Id="libbz2"/>
+				<ComponentRef Id="gmp"/>
+				<ComponentRef Id="msvcr71"/>
+				<ComponentRef Id="db_daily_cvd"/>
+				<ComponentRef Id="db_main_cvd"/>
+				<ComponentRef Id="conf"/>
+				<ComponentRef Id="log"/>
+ 			</Feature>
+			
+			<Feature Id="clamd" Title="ClamAV service" Level="1" Description="Provides scanning services for the local machine">
+				<ComponentRef Id="clamd" />
+			</Feature>
+				
+			<Feature Id="clamdscan" Level="1" Title="ClamAV client" Description="Connects to ClamAV services on local or remote machines to scan files">
+				<ComponentRef Id="clamdscan" />
+			</Feature>
+			
+			<Feature Id="clamscan" Title="ClamAV command line scanner" Level="1" Description="Provides local scanning with no need for a service">
+				<ComponentRef Id="clamscan" />
+			</Feature>
+			
+			<Feature Id="freshclam" Title="ClamAV virus database update service" Level="1" Description="Automatically keeps the virus signature files up to date">
+				<ComponentRef Id="freshclam" />
+			</Feature>
+			
+			<Feature Id="sigtool" Title="AV database signature tool" Level="1" Description="Looks like this is one for the maintainers?">
+				<ComponentRef Id="sigtool" />
+			</Feature>
+			
+			<Feature Id="test" Title="Scan test files" Level="1" Description="Harmless files that ClamAV will detect as the virus ClamAV-Test-File">
+				<ComponentRef Id="test_clam_error.rar"/>
+				<ComponentRef Id="test_clam.cab"/>
+				<ComponentRef Id="test_clam.exe"/>
+				<ComponentRef Id="test_clam.exe.bz2"/>
+				<ComponentRef Id="test_clam.rar"/>
+				<ComponentRef Id="test_clam.zip"/>
+				<ComponentRef Id="test_README"/>
+			</Feature>
+		</Feature>
+			
+		
+    <UI>
+      <Property Id="ErrorDialog"><![CDATA[ErrorDlg]]></Property>
+      <Property Id="DefaultUIFont"><![CDATA[DlgFont8]]></Property>
+      <TextStyle Id="DlgFont8" FaceName="Tahoma" Size="8" />
+      <TextStyle Id="DlgFontBold8" FaceName="Tahoma" Size="8" Bold="yes" />
+      <TextStyle Id="VerdanaBold13" FaceName="Verdana" Size="13" Bold="yes" />
+      <UIText Id="AbsentPath" />
+      <UIText Id="bytes">bytes</UIText>
+      <UIText Id="GB">GB</UIText>
+      <UIText Id="KB">KB</UIText>
+      <UIText Id="MB">MB</UIText>
+      <UIText Id="MenuAbsent">Entire feature will be unavailable</UIText>
+      <UIText Id="MenuAdvertise">Feature will be installed when required</UIText>
+      <UIText Id="MenuAllCD">Entire feature will be installed to run from CD</UIText>
+      <UIText Id="MenuAllLocal">Entire feature will be installed on local hard drive</UIText>
+      <UIText Id="MenuAllNetwork">Entire feature will be installed to run from network</UIText>
+      <UIText Id="MenuCD">Will be installed to run from CD</UIText>
+      <UIText Id="MenuLocal">Will be installed on local hard drive</UIText>
+      <UIText Id="MenuNetwork">Will be installed to run from network</UIText>
+      <UIText Id="ScriptInProgress">Gathering required information...</UIText>
+      <UIText Id="SelAbsentAbsent">This feature will remain uninstalled</UIText>
+      <UIText Id="SelAbsentAdvertise">This feature will be set to be installed when required</UIText>
+      <UIText Id="SelAbsentCD">This feature will be installed to run from CD</UIText>
+      <UIText Id="SelAbsentLocal">This feature will be installed on the local hard drive</UIText>
+      <UIText Id="SelAbsentNetwork">This feature will be installed to run from the network</UIText>
+      <UIText Id="SelAdvertiseAbsent">This feature will become unavailable</UIText>
+      <UIText Id="SelAdvertiseAdvertise">Will be installed when required</UIText>
+      <UIText Id="SelAdvertiseCD">This feature will be available to run from CD</UIText>
+      <UIText Id="SelAdvertiseLocal">This feature will be installed on your local hard drive</UIText>
+      <UIText Id="SelAdvertiseNetwork">This feature will be available to run from the network</UIText>
+      <UIText Id="SelCDAbsent">This feature will be uninstalled completely, you won't be able to run it from CD</UIText>
+      <UIText Id="SelCDAdvertise">This feature will change from run from CD state to set to be installed when required</UIText>
+      <UIText Id="SelCDCD">This feature will remain to be run from CD</UIText>
+      <UIText Id="SelCDLocal">This feature will change from run from CD state to be installed on the local hard drive</UIText>
+      <UIText Id="SelChildCostNeg">This feature frees up [1] on your hard drive.</UIText>
+      <UIText Id="SelChildCostPos">This feature requires [1] on your hard drive.</UIText>
+      <UIText Id="SelCostPending">Compiling cost for this feature...</UIText>
+      <UIText Id="SelLocalAbsent">This feature will be completely removed</UIText>
+      <UIText Id="SelLocalAdvertise">This feature will be removed from your local hard drive, but will be set to be installed when required</UIText>
+      <UIText Id="SelLocalCD">This feature will be removed from your local hard drive, but will be still available to run from CD</UIText>
+      <UIText Id="SelLocalLocal">This feature will remain on you local hard drive</UIText>
+      <UIText Id="SelLocalNetwork">This feature will be removed from your local hard drive, but will be still available to run from the network</UIText>
+      <UIText Id="SelNetworkAbsent">This feature will be uninstalled completely, you won't be able to run it from the network</UIText>
+      <UIText Id="SelNetworkAdvertise">This feature will change from run from network state to set to be installed when required</UIText>
+      <UIText Id="SelNetworkLocal">This feature will change from run from network state to be installed on the local hard drive</UIText>
+      <UIText Id="SelNetworkNetwork">This feature will remain to be run from the network</UIText>
+      <UIText Id="SelParentCostNegNeg">This feature frees up [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures free up [4] on your hard drive.</UIText>
+      <UIText Id="SelParentCostNegPos">This feature frees up [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures require [4] on your hard drive.</UIText>
+      <UIText Id="SelParentCostPosNeg">This feature requires [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures free up [4] on your hard drive.</UIText>
+      <UIText Id="SelParentCostPosPos">This feature requires [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures require [4] on your hard drive.</UIText>
+      <UIText Id="TimeRemaining">Time remaining: {[1] minutes }{[2] seconds}</UIText>
+      <UIText Id="VolumeCostAvailable">Available</UIText>
+      <UIText Id="VolumeCostDifference">Difference</UIText>
+      <UIText Id="VolumeCostRequired">Required</UIText>
+      <UIText Id="VolumeCostSize">Disk Size</UIText>
+      <UIText Id="VolumeCostVolume">Volume</UIText>
+      <ProgressText Action="InstallValidate">Validating install</ProgressText>
+      <ProgressText Action="InstallFiles" Template="File: [1],  Directory: [9],  Size: [6]">Copying new files</ProgressText>
+      <ProgressText Action="InstallAdminPackage" Template="File: [1], Directory: [9], Size: [6]">Copying network install files</ProgressText>
+      <ProgressText Action="FileCost">Computing space requirements</ProgressText>
+      <ProgressText Action="CostInitialize">Computing space requirements</ProgressText>
+      <ProgressText Action="CostFinalize">Computing space requirements</ProgressText>
+      <ProgressText Action="CreateShortcuts" Template="Shortcut: [1]">Creating shortcuts</ProgressText>
+      <ProgressText Action="PublishComponents" Template="Component ID: [1], Qualifier: [2]">Publishing Qualified Components</ProgressText>
+      <ProgressText Action="PublishFeatures" Template="Feature: [1]">Publishing Product Features</ProgressText>
+      <ProgressText Action="PublishProduct">Publishing product information</ProgressText>
+      <ProgressText Action="RegisterClassInfo" Template="Class Id: [1]">Registering Class servers</ProgressText>
+      <ProgressText Action="RegisterExtensionInfo" Template="Extension: [1]">Registering extension servers</ProgressText>
+      <ProgressText Action="RegisterMIMEInfo" Template="MIME Content Type: [1], Extension: [2]">Registering MIME info</ProgressText>
+      <ProgressText Action="RegisterProgIdInfo" Template="ProgId: [1]">Registering program identifiers</ProgressText>
+      <ProgressText Action="AllocateRegistrySpace" Template="Free space: [1]">Allocating registry space</ProgressText>
+      <ProgressText Action="AppSearch" Template="Property: [1], Signature: [2]">Searching for installed applications</ProgressText>
+      <ProgressText Action="BindImage" Template="File: [1]">Binding executables</ProgressText>
+      <ProgressText Action="CCPSearch">Searching for qualifying products</ProgressText>
+      <ProgressText Action="CreateFolders" Template="Folder: [1]">Creating folders</ProgressText>
+      <ProgressText Action="DeleteServices" Template="Service: [1]">Deleting services</ProgressText>
+      <ProgressText Action="DuplicateFiles" Template="File: [1],  Directory: [9],  Size: [6]">Creating duplicate files</ProgressText>
+      <ProgressText Action="FindRelatedProducts" Template="Found application: [1]">Searching for related applications</ProgressText>
+      <ProgressText Action="InstallODBC">Installing ODBC components</ProgressText>
+      <ProgressText Action="InstallServices" Template="Service: [2]">Installing new services</ProgressText>
+      <ProgressText Action="LaunchConditions">Evaluating launch conditions</ProgressText>
+      <ProgressText Action="MigrateFeatureStates" Template="Application: [1]">Migrating feature states from related applications</ProgressText>
+      <ProgressText Action="MoveFiles" Template="File: [1],  Directory: [9],  Size: [6]">Moving files</ProgressText>
+      <ProgressText Action="PatchFiles" Template="File: [1],  Directory: [2],  Size: [3]">Patching files</ProgressText>
+      <ProgressText Action="ProcessComponents">Updating component registration</ProgressText>
+      <ProgressText Action="RegisterComPlus" Template="AppId: [1]{{, AppType: [2], Users: [3], RSN: [4]}}">Registering COM+ Applications and Components</ProgressText>
+      <ProgressText Action="RegisterFonts" Template="Font: [1]">Registering fonts</ProgressText>
+      <ProgressText Action="RegisterProduct" Template="[1]">Registering product</ProgressText>
+      <ProgressText Action="RegisterTypeLibraries" Template="LibID: [1]">Registering type libraries</ProgressText>
+      <ProgressText Action="RegisterUser" Template="[1]">Registering user</ProgressText>
+      <ProgressText Action="RemoveDuplicateFiles" Template="File: [1], Directory: [9]">Removing duplicated files</ProgressText>
+      <ProgressText Action="RemoveEnvironmentStrings" Template="Name: [1], Value: [2], Action [3]">Updating environment strings</ProgressText>
+      <ProgressText Action="RemoveExistingProducts" Template="Application: [1], Command line: [2]">Removing applications</ProgressText>
+      <ProgressText Action="RemoveFiles" Template="File: [1], Directory: [9]">Removing files</ProgressText>
+      <ProgressText Action="RemoveFolders" Template="Folder: [1]">Removing folders</ProgressText>
+      <ProgressText Action="RemoveIniValues" Template="File: [1],  Section: [2],  Key: [3], Value: [4]">Removing INI files entries</ProgressText>
+      <ProgressText Action="RemoveODBC">Removing ODBC components</ProgressText>
+      <ProgressText Action="RemoveRegistryValues" Template="Key: [1], Name: [2]">Removing system registry values</ProgressText>
+      <ProgressText Action="RemoveShortcuts" Template="Shortcut: [1]">Removing shortcuts</ProgressText>
+      <ProgressText Action="RMCCPSearch">Searching for qualifying products</ProgressText>
+      <ProgressText Action="SelfRegModules" Template="File: [1], Folder: [2]">Registering modules</ProgressText>
+      <ProgressText Action="SelfUnregModules" Template="File: [1], Folder: [2]">Unregistering modules</ProgressText>
+      <ProgressText Action="SetODBCFolders">Initializing ODBC directories</ProgressText>
+      <ProgressText Action="StartServices" Template="Service: [1]">Starting services</ProgressText>
+      <ProgressText Action="StopServices" Template="Service: [1]">Stopping services</ProgressText>
+      <ProgressText Action="UnpublishComponents" Template="Component ID: [1], Qualifier: [2]">Unpublishing Qualified Components</ProgressText>
+      <ProgressText Action="UnpublishFeatures" Template="Feature: [1]">Unpublishing Product Features</ProgressText>
+      <ProgressText Action="UnregisterClassInfo" Template="Class Id: [1]">Unregister Class servers</ProgressText>
+      <ProgressText Action="UnregisterComPlus" Template="AppId: [1]{{, AppType: [2]}}">Unregistering COM+ Applications and Components</ProgressText>
+      <ProgressText Action="UnregisterExtensionInfo" Template="Extension: [1]">Unregistering extension servers</ProgressText>
+      <ProgressText Action="UnregisterFonts" Template="Font: [1]">Unregistering fonts</ProgressText>
+      <ProgressText Action="UnregisterMIMEInfo" Template="MIME Content Type: [1], Extension: [2]">Unregistering MIME info</ProgressText>
+      <ProgressText Action="UnregisterProgIdInfo" Template="ProgId: [1]">Unregistering program identifiers</ProgressText>
+      <ProgressText Action="UnregisterTypeLibraries" Template="LibID: [1]">Unregistering type libraries</ProgressText>
+      <ProgressText Action="WriteEnvironmentStrings" Template="Name: [1], Value: [2], Action [3]">Updating environment strings</ProgressText>
+      <ProgressText Action="WriteIniValues" Template="File: [1],  Section: [2],  Key: [3], Value: [4]">Writing INI files values</ProgressText>
+      <ProgressText Action="WriteRegistryValues" Template="Key: [1], Name: [2], Value: [3]">Writing system registry values</ProgressText>
+      <ProgressText Action="Advertise">Advertising application</ProgressText>
+      <ProgressText Action="GenerateScript" Template="[1]">Generating script operations for action:</ProgressText>
+      <ProgressText Action="InstallSFPCatalogFile" Template="File: [1],  Dependencies: [2]">Installing system catalog</ProgressText>
+      <ProgressText Action="MsiPublishAssemblies" Template="Application Context:[1], Assembly Name:[2]">Publishing assembly information</ProgressText>
+      <ProgressText Action="MsiUnpublishAssemblies" Template="Application Context:[1], Assembly Name:[2]">Unpublishing assembly information</ProgressText>
+      <ProgressText Action="Rollback" Template="[1]">Rolling back action:</ProgressText>
+      <ProgressText Action="RollbackCleanup" Template="File: [1]">Removing backup files</ProgressText>
+      <ProgressText Action="UnmoveFiles" Template="File: [1], Directory: [9]">Removing moved files</ProgressText>
+      <ProgressText Action="UnpublishProduct">Unpublishing product information</ProgressText>
+      <Dialog Id="AdminWelcomeDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Next]">
+          <Publish Property="InstallMode" Value="Server Image"><![CDATA[1]]></Publish>
+          <Publish Event="NewDialog" Value="AdminRegistrationDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="[DialogBitmap]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Back]" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="30" Transparent="yes" NoPrefix="yes">
+          <Text>The [Wizard] will create a server image of [ProductName], at a specified network location.  Click Next to continue or Cancel to exit the [Wizard].</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
+          <Text>{\VerdanaBold13}Welcome to the [ProductName] [Wizard]</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="ExitDialog" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Finish]">
+          <Publish Event="EndDialog" Value="Return"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Cancel]" />
+        <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="[DialogBitmap]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Back]" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="20" Transparent="yes" NoPrefix="yes">
+          <Text>Click the Finish button to exit the [Wizard].</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
+          <Text>{\VerdanaBold13}Completing the [ProductName] [Wizard]</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="FatalError" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Finish]">
+          <Publish Event="EndDialog" Value="Exit"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Cancel]" />
+        <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="[DialogBitmap]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Back]" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
+          <Text>{\VerdanaBold13}[ProductName] [Wizard] ended prematurely</Text>
+        </Control>
+        <Control Id="Description1" Type="Text" X="135" Y="70" Width="220" Height="40" Transparent="yes" NoPrefix="yes">
+          <Text>[ProductName] setup ended prematurely because of an error.  Your system has not been modified.  To install this program at a later time, please run the installation again.</Text>
+        </Control>
+        <Control Id="Description2" Type="Text" X="135" Y="115" Width="220" Height="20" Transparent="yes" NoPrefix="yes">
+          <Text>Click the Finish button to exit the [Wizard].</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="PrepareDlg" Width="370" Height="270" Title="[ProductName] [Setup]" Modeless="yes">
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="[DialogBitmap]" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="20" Transparent="yes" NoPrefix="yes">
+          <Text>Please wait while the [Wizard] prepares to guide you through the installation.</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
+          <Text>{\VerdanaBold13}Welcome to the [ProductName] [Wizard]</Text>
+        </Control>
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" TabSkip="yes" Text="[ButtonText_Back]" />
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" TabSkip="yes" Text="[ButtonText_Next]" />
+        <Control Id="ActionData" Type="Text" X="135" Y="125" Width="220" Height="30" Transparent="yes" NoPrefix="yes">
+          <Subscribe Event="ActionData" Attribute="Text" />
+        </Control>
+        <Control Id="ActionText" Type="Text" X="135" Y="100" Width="220" Height="20" Transparent="yes" NoPrefix="yes">
+          <Subscribe Event="ActionText" Attribute="Text" />
+        </Control>
+      </Dialog>
+      <Dialog Id="ProgressDlg" Width="370" Height="270" Title="[ProductName] [Setup]" Modeless="yes">
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Back]" />
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Next]" />
+        <Control Id="Text" Type="Text" X="35" Y="65" Width="300" Height="20">
+          <Text>Please wait while the [Wizard] [Progress2] [ProductName].  This may take several minutes.</Text>
+        </Control>
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Title" Type="Text" X="20" Y="15" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont][Progress1] [ProductName]</Text>
+        </Control>
+        <Control Id="ActionText" Type="Text" X="70" Y="100" Width="265" Height="10">
+          <Subscribe Event="ActionText" Attribute="Text" />
+        </Control>
+        <Control Id="ProgressBar" Type="ProgressBar" X="35" Y="115" Width="300" Height="10" ProgressBlocks="yes" Text="Progress done">
+          <Subscribe Event="SetProgress" Attribute="Progress" />
+        </Control>
+        <Control Id="StatusLabel" Type="Text" X="35" Y="100" Width="35" Height="10" Text="Status:" />
+      </Dialog>
+      <Dialog Id="UserExit" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Finish]">
+          <Publish Event="EndDialog" Value="Exit"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Cancel]" />
+        <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="[DialogBitmap]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Back]" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
+          <Text>{\VerdanaBold13}[ProductName] [Wizard] was interrupted</Text>
+        </Control>
+        <Control Id="Description1" Type="Text" X="135" Y="70" Width="220" Height="40" Transparent="yes" NoPrefix="yes">
+          <Text>[ProductName] setup was interrupted.  Your system has not been modified.  To install this program at a later time, please run the installation again.</Text>
+        </Control>
+        <Control Id="Description2" Type="Text" X="135" Y="115" Width="220" Height="20" Transparent="yes" NoPrefix="yes">
+          <Text>Click the Finish button to exit the [Wizard].</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="AdminBrowseDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="PathEdit" Type="PathEdit" X="84" Y="202" Width="261" Height="17" Property="TARGETDIR" />
+        <Control Id="OK" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_OK]">
+          <Publish Event="SetTargetPath" Value="TARGETDIR"><![CDATA[1]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="240" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="Reset" Value="0"><![CDATA[1]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="ComboLabel" Type="Text" X="25" Y="58" Width="44" Height="10" TabSkip="no" Text="&amp;Look in:" />
+        <Control Id="DirectoryCombo" Type="DirectoryCombo" X="70" Y="55" Width="220" Height="80" Property="TARGETDIR" Removable="yes" Fixed="yes" Remote="yes">
+          <Subscribe Event="IgnoreChange" Attribute="IgnoreChange" />
+        </Control>
+        <Control Id="Up" Type="PushButton" X="298" Y="55" Width="19" Height="19" ToolTip="Up One Level" Icon="yes" FixedSize="yes" IconSize="16" Text="Up">
+          <Publish Event="DirectoryListUp" Value="0"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="NewFolder" Type="PushButton" X="325" Y="55" Width="19" Height="19" ToolTip="Create A New Folder" Icon="yes" FixedSize="yes" IconSize="16" Text="New">
+          <Publish Event="DirectoryListNew" Value="0"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="DirectoryList" Type="DirectoryList" X="25" Y="83" Width="320" Height="110" Property="TARGETDIR" Sunken="yes" TabSkip="no" />
+        <Control Id="PathLabel" Type="Text" X="25" Y="205" Width="59" Height="10" TabSkip="no" Text="&amp;Folder name:" />
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>Browse to the destination folder</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Change current destination folder</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="AdminInstallPointDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="Text" Type="Text" X="25" Y="80" Width="320" Height="10" TabSkip="no">
+          <Text>&amp;Enter a new network location or click Browse to browse to one.</Text>
+        </Control>
+        <Control Id="PathEdit" Type="PathEdit" X="25" Y="93" Width="320" Height="18" Property="TARGETDIR" />
+        <Control Id="Browse" Type="PushButton" X="289" Y="119" Width="56" Height="17" Text="[ButtonText_Browse]">
+          <Publish Event="SpawnDialog" Value="AdminBrowseDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="[ButtonText_Back]">
+          <Publish Event="NewDialog" Value="AdminRegistrationDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Next]">
+          <Publish Event="SetTargetPath" Value="TARGETDIR"><![CDATA[1]]></Publish>
+          <Publish Event="NewDialog" Value="VerifyReadyDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="20" Width="280" Height="20" Transparent="yes" NoPrefix="yes">
+          <Text>Please specify a network location for the server image of [ProductName] product</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Network Location</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="AdminRegistrationDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="OrganizationLabel" Type="Text" X="45" Y="71" Width="285" Height="30" TabSkip="no">
+          <Text>&amp;Please enter the name of your organization in the box below.  This will be used as default company name for subsequent installations of [ProductName]:</Text>
+        </Control>
+        <Control Id="OrganizationEdit" Type="Edit" X="45" Y="105" Width="220" Height="18" Property="COMPANYNAME" Text="{80}" />
+        <Control Id="CDKeyLabel" Type="Text" X="45" Y="130" Width="50" Height="10" TabSkip="no">
+          <Text>CD &amp;Key:</Text>
+        </Control>
+        <Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="143" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Image="yes" Text="[ButtonText_Back]">
+          <Publish Event="NewDialog" Value="AdminWelcomeDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Next]">
+          <Publish Event="ValidateProductID" Value="0"><![CDATA[0]]></Publish>
+          <Publish Event="NewDialog" Value="AdminInstallPointDlg"><![CDATA[ProductID]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>Please enter your company information</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Company Information</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="BrowseDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="PathEdit" Type="PathEdit" X="84" Y="202" Width="261" Height="18" Property="_BrowseProperty" Indirect="yes" />
+        <Control Id="OK" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_OK]">
+          <Publish Event="SetTargetPath" Value="[_BrowseProperty]"><![CDATA[1]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="240" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="Reset" Value="0"><![CDATA[1]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="ComboLabel" Type="Text" X="25" Y="58" Width="44" Height="10" TabSkip="no" Text="&amp;Look in:" />
+        <Control Id="DirectoryCombo" Type="DirectoryCombo" X="70" Y="55" Width="220" Height="80" Property="_BrowseProperty" Indirect="yes" Fixed="yes" Remote="yes">
+          <Subscribe Event="IgnoreChange" Attribute="IgnoreChange" />
+        </Control>
+        <Control Id="Up" Type="PushButton" X="298" Y="55" Width="19" Height="19" ToolTip="Up One Level" Icon="yes" FixedSize="yes" IconSize="16" Text="Up">
+          <Publish Event="DirectoryListUp" Value="0"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="NewFolder" Type="PushButton" X="325" Y="55" Width="19" Height="19" ToolTip="Create A New Folder" Icon="yes" FixedSize="yes" IconSize="16" Text="New">
+          <Publish Event="DirectoryListNew" Value="0"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="DirectoryList" Type="DirectoryList" X="25" Y="83" Width="320" Height="110" Property="_BrowseProperty" Sunken="yes" Indirect="yes" TabSkip="no" />
+        <Control Id="PathLabel" Type="Text" X="25" Y="205" Width="59" Height="10" TabSkip="no" Text="&amp;Folder name:" />
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>Browse to the destination folder</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Change current destination folder</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="CancelDlg" Y="10" Width="260" Height="85" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="No" Type="PushButton" X="132" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_No]">
+          <Publish Event="EndDialog" Value="Return"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Yes" Type="PushButton" X="72" Y="57" Width="56" Height="17" Text="[ButtonText_Yes]">
+          <Publish Event="EndDialog" Value="Exit"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30">
+          <Text>Are you sure you want to cancel [ProductName] installation?</Text>
+        </Control>
+        <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="[InfoIcon]" />
+      </Dialog>
+      <Dialog Id="CustomizeDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes" TrackDiskSpace="yes">
+        <Control Id="Tree" Type="SelectionTree" X="25" Y="85" Width="175" Height="95" Property="_BrowseProperty" Sunken="yes" TabSkip="no" Text="Tree of selections" />
+        <Control Id="Browse" Type="PushButton" X="304" Y="200" Width="56" Height="17" Text="[ButtonText_Browse]">
+          <Publish Event="SelectionBrowse" Value="BrowseDlg"><![CDATA[1]]></Publish>
+          <Condition Action="hide"><![CDATA[Installed]]></Condition>
+        </Control>
+        <Control Id="Reset" Type="PushButton" X="42" Y="243" Width="56" Height="17" Text="[ButtonText_Reset]">
+          <Publish Event="Reset" Value="0"><![CDATA[1]]></Publish>
+          <Subscribe Event="SelectionNoItems" Attribute="Enabled" />
+        </Control>
+        <Control Id="DiskCost" Type="PushButton" X="111" Y="243" Width="56" Height="17">
+          <Text>Disk &amp;Usage</Text>
+          <Publish Event="SpawnDialog" Value="DiskCostDlg"><![CDATA[1]]></Publish>
+          <Subscribe Event="SelectionNoItems" Attribute="Enabled" />
+        </Control>
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="[ButtonText_Back]">
+          <Publish Event="NewDialog" Value="MaintenanceTypeDlg"><![CDATA[InstallMode = "Change"]]></Publish>
+          <Publish Event="NewDialog" Value="SetupTypeDlg"><![CDATA[InstallMode = "Custom"]]></Publish>
+        </Control>
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Next]">
+          <Publish Event="NewDialog" Value="VerifyReadyDlg"><![CDATA[1]]></Publish>
+          <Subscribe Event="SelectionNoItems" Attribute="Enabled" />
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="Text" Type="Text" X="25" Y="55" Width="320" Height="20">
+          <Text>Click on the icons in the tree below to change the way features will be installed.</Text>
+        </Control>
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>Select the way you want features to be installed.</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Custom Setup</Text>
+        </Control>
+        <Control Id="Box" Type="GroupBox" X="210" Y="81" Width="140" Height="98" />
+        <Control Id="ItemDescription" Type="Text" X="215" Y="90" Width="131" Height="30">
+          <Text>Multiline description of the currently selected item.</Text>
+          <Subscribe Event="SelectionDescription" Attribute="Text" />
+        </Control>
+        <Control Id="ItemSize" Type="Text" X="215" Y="130" Width="131" Height="45">
+          <Text>The size of the currently selected item.</Text>
+          <Subscribe Event="SelectionSize" Attribute="Text" />
+        </Control>
+        <Control Id="Location" Type="Text" X="75" Y="200" Width="215" Height="20">
+          <Text>&lt;The selection's path&gt;</Text>
+          <Subscribe Event="SelectionPath" Attribute="Text" />
+          <Subscribe Event="SelectionPathOn" Attribute="Visible" />
+          <Condition Action="hide"><![CDATA[Installed]]></Condition>
+        </Control>
+        <Control Id="LocationLabel" Type="Text" X="25" Y="200" Width="50" Height="10" Text="Location:">
+          <Subscribe Event="SelectionPathOn" Attribute="Visible" />
+          <Condition Action="hide"><![CDATA[Installed]]></Condition>
+        </Control>
+      </Dialog>
+      <Dialog Id="DiskCostDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="OK" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_OK]">
+          <Publish Event="EndDialog" Value="Return"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="Text" Type="Text" X="20" Y="53" Width="330" Height="40">
+          <Text>The highlighted volumes (if any) do not have enough disk space available for the currently selected features.  You can either remove some files from the highlighted volumes, or choose to install less features onto local drive(s), or select different destination drive(s).</Text>
+        </Control>
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="20" Y="20" Width="280" Height="20" Transparent="yes" NoPrefix="yes">
+          <Text>The disk space required for the installation of the selected features.</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Disk Space Requirements</Text>
+        </Control>
+        <Control Id="VolumeList" Type="VolumeCostList" X="20" Y="100" Width="330" Height="120" Sunken="yes" Fixed="yes" Remote="yes">
+          <Text>{120}{70}{70}{70}{70}</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="ErrorDlg" Y="10" Width="270" Height="105" Title="Installer Information" ErrorDialog="yes" NoMinimize="yes">
+        <Control Id="ErrorText" Type="Text" X="48" Y="15" Width="205" Height="60" TabSkip="no" Text="Information text" />
+        <Control Id="Y" Type="PushButton" X="100" Y="80" Width="56" Height="17" TabSkip="yes" Text="[ButtonText_Yes]">
+          <Publish Event="EndDialog" Value="ErrorYes"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="A" Type="PushButton" X="100" Y="80" Width="56" Height="17" TabSkip="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="EndDialog" Value="ErrorAbort"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="C" Type="PushButton" X="100" Y="80" Width="56" Height="17" TabSkip="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="EndDialog" Value="ErrorCancel"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="ErrorIcon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="[InfoIcon]" />
+        <Control Id="I" Type="PushButton" X="100" Y="80" Width="56" Height="17" TabSkip="yes" Text="[ButtonText_Ignore]">
+          <Publish Event="EndDialog" Value="ErrorIgnore"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="N" Type="PushButton" X="100" Y="80" Width="56" Height="17" TabSkip="yes" Text="[ButtonText_No]">
+          <Publish Event="EndDialog" Value="ErrorNo"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="O" Type="PushButton" X="100" Y="80" Width="56" Height="17" TabSkip="yes" Text="[ButtonText_OK]">
+          <Publish Event="EndDialog" Value="ErrorOk"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="R" Type="PushButton" X="100" Y="80" Width="56" Height="17" TabSkip="yes" Text="[ButtonText_Retry]">
+          <Publish Event="EndDialog" Value="ErrorRetry"><![CDATA[1]]></Publish>
+        </Control>
+      </Dialog>
+      <Dialog Id="FilesInUse" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes" KeepModeless="yes">
+        <Control Id="Retry" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Retry]">
+          <Publish Event="EndDialog" Value="Retry"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Ignore" Type="PushButton" X="235" Y="243" Width="56" Height="17" Text="[ButtonText_Ignore]">
+          <Publish Event="EndDialog" Value="Ignore"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Exit" Type="PushButton" X="166" Y="243" Width="56" Height="17" Text="[ButtonText_Exit]">
+          <Publish Event="EndDialog" Value="Exit"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="Text" Type="Text" X="20" Y="55" Width="330" Height="30">
+          <Text>The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.</Text>
+        </Control>
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="20" Y="23" Width="280" Height="20" Transparent="yes" NoPrefix="yes">
+          <Text>Some files that need to be updated are currently in use.</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Files in Use</Text>
+        </Control>
+        <Control Id="List" Type="ListBox" X="20" Y="87" Width="330" Height="130" Property="FileInUseProcess" Sunken="yes" TabSkip="yes" />
+      </Dialog>
+      <Dialog Id="LicenceAgreementDlg" Width="370" Height="270" Title="[ProductName] Licence Agreement" NoMinimize="yes">
+        <Control Id="Buttons" Type="RadioButtonGroup" X="20" Y="187" Width="330" Height="40" Property="IAgree">
+          <RadioButtonGroup Property="IAgree">
+            <RadioButton Value="Yes" X="5" Y="0" Width="250" Height="15" Text="{\DlgFont8}I &amp;accept the terms in the Licence Agreement" />
+            <RadioButton Value="No" X="5" Y="20" Width="250" Height="15" Text="{\DlgFont8}I &amp;do not accept the terms in the Licence Agreement" />
+          </RadioButtonGroup>
+        </Control>
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="[ButtonText_Back]">
+          <Publish Event="NewDialog" Value="WelcomeDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Next]">
+          <Publish Event="NewDialog" Value="UserRegistrationDlg"><![CDATA[IAgree = "Yes" AND ShowUserRegistrationDlg = 1]]></Publish>
+          <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg"><![CDATA[CostingComplete = 1]]></Publish>
+          <Publish Event="NewDialog" Value="SetupTypeDlg"><![CDATA[IAgree = "Yes" AND ShowUserRegistrationDlg <> 1]]></Publish>
+          <Condition Action="disable"><![CDATA[IAgree <> "Yes"]]></Condition>
+          <Condition Action="enable"><![CDATA[IAgree = "Yes"]]></Condition>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="AgreementText" Type="ScrollableText" X="20" Y="60" Width="330" Height="120" Sunken="yes" TabSkip="no">
+          <Text src="Binary\GPL.rtf"/>
+        </Control>
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>Please read the following licence agreement carefully</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]End-User Licence Agreement</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="MaintenanceTypeDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="ChangeLabel" Type="Text" X="105" Y="65" Width="100" Height="10" TabSkip="no">
+          <Text>[DlgTitleFont]&amp;Modify</Text>
+        </Control>
+        <Control Id="ChangeButton" Type="PushButton" X="50" Y="65" Width="38" Height="38" ToolTip="Modify Installation" Default="yes" Icon="yes" FixedSize="yes" IconSize="32" Text="[CustomSetupIcon]">
+          <Publish Property="InstallMode" Value="Change"><![CDATA[1]]></Publish>
+          <Publish Property="Progress1" Value="Changing"><![CDATA[1]]></Publish>
+          <Publish Property="Progress2" Value="changes"><![CDATA[1]]></Publish>
+          <Publish Event="NewDialog" Value="CustomizeDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="RepairLabel" Type="Text" X="105" Y="114" Width="100" Height="10" TabSkip="no">
+          <Text>[DlgTitleFont]Re&amp;pair</Text>
+        </Control>
+        <Control Id="RepairButton" Type="PushButton" X="50" Y="114" Width="38" Height="38" ToolTip="Repair Installation" Icon="yes" FixedSize="yes" IconSize="32" Text="[RepairIcon]">
+          <Publish Property="InstallMode" Value="Repair"><![CDATA[1]]></Publish>
+          <Publish Property="Progress1" Value="Repairing"><![CDATA[1]]></Publish>
+          <Publish Property="Progress2" Value="repaires"><![CDATA[1]]></Publish>
+          <Publish Event="NewDialog" Value="VerifyRepairDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="RemoveLabel" Type="Text" X="105" Y="163" Width="100" Height="10" TabSkip="no">
+          <Text>[DlgTitleFont]&amp;Remove</Text>
+        </Control>
+        <Control Id="RemoveButton" Type="PushButton" X="50" Y="163" Width="38" Height="38" ToolTip="Remove Installation" Icon="yes" FixedSize="yes" IconSize="32" Text="[RemoveIcon]">
+          <Publish Property="InstallMode" Value="Remove"><![CDATA[1]]></Publish>
+          <Publish Property="Progress1" Value="Removing"><![CDATA[1]]></Publish>
+          <Publish Property="Progress2" Value="removes"><![CDATA[1]]></Publish>
+          <Publish Event="NewDialog" Value="VerifyRemoveDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="[ButtonText_Back]">
+          <Publish Event="NewDialog" Value="MaintenanceWelcomeDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Next]" />
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="20" Transparent="yes" NoPrefix="yes">
+          <Text>Select the operation you wish to perform.</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="240" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Modify, Repair or Remove installation</Text>
+        </Control>
+        <Control Id="ChangeText" Type="Text" X="105" Y="78" Width="230" Height="20">
+          <Text>Allows users to change the way features are installed.</Text>
+        </Control>
+        <Control Id="RemoveText" Type="Text" X="105" Y="176" Width="230" Height="20">
+          <Text>Removes [ProductName] from your computer.</Text>
+        </Control>
+        <Control Id="RepairText" Type="Text" X="105" Y="127" Width="230" Height="30">
+          <Text>Repairs errors in the most recent installation state - fixes missing or corrupt files, shortcuts and registry entries.</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="MaintenanceWelcomeDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Next]">
+          <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg"><![CDATA[CostingComplete = 1]]></Publish>
+          <Publish Event="NewDialog" Value="MaintenanceTypeDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="[DialogBitmap]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Back]" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
+          <Text>The [Wizard] will allow you to change the way [ProductName] features are installed on your computer or even to remove [ProductName] from your computer.  Click Next to continue or Cancel to exit the [Wizard].</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
+          <Text>{\VerdanaBold13}Welcome to the [ProductName] [Wizard]</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="OutOfDiskDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="OK" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_OK]">
+          <Publish Event="EndDialog" Value="Return"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="Text" Type="Text" X="20" Y="53" Width="330" Height="40">
+          <Text>The highlighted volumes do not have enough disk space available for the currently selected features.  You can either remove some files from the highlighted volumes, or choose to install less features onto local drive(s), or select different destination drive(s).</Text>
+        </Control>
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="20" Y="20" Width="280" Height="20" Transparent="yes" NoPrefix="yes">
+          <Text>Disk space required for the installation exceeds available disk space.</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Out of Disk Space</Text>
+        </Control>
+        <Control Id="VolumeList" Type="VolumeCostList" X="20" Y="100" Width="330" Height="120" Sunken="yes" Fixed="yes" Remote="yes">
+          <Text>{120}{70}{70}{70}{70}</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="OutOfRbDiskDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="No" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_No]">
+          <Publish Event="EndDialog" Value="Return"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Yes" Type="PushButton" X="240" Y="243" Width="56" Height="17" Text="[ButtonText_Yes]">
+          <Publish Event="EnableRollback" Value="False"><![CDATA[1]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="Text" Type="Text" X="20" Y="53" Width="330" Height="40">
+          <Text>The highlighted volumes do not have enough disk space available for the currently selected features.  You can either remove some files from the highlighted volumes, or choose to install less features onto local drive(s), or select different destination drive(s).</Text>
+        </Control>
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="20" Y="20" Width="280" Height="20" Transparent="yes" NoPrefix="yes">
+          <Text>Disk space required for the installation exceeds available disk space.</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Out of Disk Space</Text>
+        </Control>
+        <Control Id="VolumeList" Type="VolumeCostList" X="20" Y="140" Width="330" Height="80" Sunken="yes" Fixed="yes" Remote="yes" ShowRollbackCost="yes">
+          <Text>{120}{70}{70}{70}{70}</Text>
+        </Control>
+        <Control Id="Text2" Type="Text" X="20" Y="94" Width="330" Height="40">
+          <Text>Alternatively, you may choose to disable the installer's rollback functionality.  This allows the installer to restore your computer's original state should the installation be interrupted in any way.  Click Yes if you wish to take the risk to disable rollback.</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="ResumeDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="Install" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Install]">
+          <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg"><![CDATA[CostingComplete = 1]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
+          <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"]]></Publish>
+          <Publish Event="EnableRollback" Value="False"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"]]></Publish>
+          <Publish Event="SpawnDialog" Value="OutOfDiskDlg"><![CDATA[(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="[DialogBitmap]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Back]" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="30" Transparent="yes" NoPrefix="yes">
+          <Text>The [Wizard] will complete the installation of [ProductName] on your computer.  Click Install to continue or Cancel to exit the [Wizard].</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
+          <Text>{\VerdanaBold13}Resuming the [ProductName] [Wizard]</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="SetupTypeDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="TypicalLabel" Type="Text" X="105" Y="65" Width="100" Height="10" TabSkip="no">
+          <Text>[DlgTitleFont]&amp;Typical</Text>
+        </Control>
+        <Control Id="TypicalButton" Type="PushButton" X="50" Y="65" Width="38" Height="38" ToolTip="Typical Installation" Default="yes" Icon="yes" FixedSize="yes" IconSize="32" Text="[InstallerIcon]">
+          <Publish Property="InstallMode" Value="Typical"><![CDATA[1]]></Publish>
+          <Publish Event="SetInstallLevel" Value="3"><![CDATA[1]]></Publish>
+          <Publish Event="NewDialog" Value="VerifyReadyDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="CustomLabel" Type="Text" X="105" Y="118" Width="100" Height="10" TabSkip="no">
+          <Text>[DlgTitleFont]C&amp;ustom</Text>
+        </Control>
+        <Control Id="CustomButton" Type="PushButton" X="50" Y="118" Width="38" Height="38" ToolTip="Custom Installation" Icon="yes" FixedSize="yes" IconSize="32" Text="[CustomSetupIcon]">
+          <Publish Property="InstallMode" Value="Custom"><![CDATA[1]]></Publish>
+          <Publish Event="NewDialog" Value="CustomizeDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="CompleteLabel" Type="Text" X="105" Y="171" Width="100" Height="10" TabSkip="no">
+          <Text>[DlgTitleFont]C&amp;omplete</Text>
+        </Control>
+        <Control Id="CompleteButton" Type="PushButton" X="50" Y="171" Width="38" Height="38" ToolTip="Complete Installation" Icon="yes" FixedSize="yes" IconSize="32" Text="[CompleteSetupIcon]">
+          <Publish Property="InstallMode" Value="Complete"><![CDATA[1]]></Publish>
+          <Publish Event="SetInstallLevel" Value="1000"><![CDATA[1]]></Publish>
+          <Publish Event="NewDialog" Value="VerifyReadyDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="[ButtonText_Back]">
+          <Publish Event="NewDialog" Value="LicenceAgreementDlg"><![CDATA[ShowUserRegistrationDlg <> 1]]></Publish>
+          <Publish Event="NewDialog" Value="UserRegistrationDlg"><![CDATA[ShowUserRegistrationDlg = 1]]></Publish>
+        </Control>
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Next]" />
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>Choose the setup type that best suits your needs</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Choose Setup Type</Text>
+        </Control>
+        <Control Id="CompleteText" Type="Text" X="105" Y="184" Width="230" Height="20">
+          <Text>All program features will be installed.  (Requires most disk space)</Text>
+        </Control>
+        <Control Id="CustomText" Type="Text" X="105" Y="131" Width="230" Height="30">
+          <Text>Allows users to choose which program features will be installed and where they will be installed. Recommended for advanced users.</Text>
+        </Control>
+        <Control Id="TypicalText" Type="Text" X="105" Y="78" Width="230" Height="20">
+          <Text>Installs the most common program features. Recommended for most users.</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="NameLabel" Type="Text" X="45" Y="73" Width="100" Height="15" TabSkip="no" Text="&amp;User Name:" />
+        <Control Id="NameEdit" Type="Edit" X="45" Y="85" Width="220" Height="18" Property="USERNAME" Text="{80}" />
+        <Control Id="OrganizationLabel" Type="Text" X="45" Y="110" Width="100" Height="15" TabSkip="no" Text="&amp;Organization:" />
+        <Control Id="OrganizationEdit" Type="Edit" X="45" Y="122" Width="220" Height="18" Property="COMPANYNAME" Text="{80}" />
+        <Control Id="CDKeyLabel" Type="Text" X="45" Y="147" Width="50" Height="10" TabSkip="no">
+          <Text>CD &amp;Key:</Text>
+        </Control>
+        <Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="159" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="[ButtonText_Back]">
+          <Publish Event="NewDialog" Value="LicenceAgreementDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Next]">
+          <Publish Event="ValidateProductID" Value="0"><![CDATA[0]]></Publish>
+          <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg"><![CDATA[CostingComplete = 1]]></Publish>
+          <Publish Event="NewDialog" Value="SetupTypeDlg"><![CDATA[ProductID]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>Please enter your customer information</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Customer Information</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="VerifyReadyDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes" TrackDiskSpace="yes">
+        <Control Id="Install" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Install]">
+          <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
+          <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"]]></Publish>
+          <Publish Event="EnableRollback" Value="False"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"]]></Publish>
+          <Publish Event="SpawnDialog" Value="OutOfDiskDlg"><![CDATA[(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="[ButtonText_Back]">
+          <Publish Event="NewDialog" Value="AdminInstallPointDlg"><![CDATA[InstallMode = "Server Image"]]></Publish>
+          <Publish Event="NewDialog" Value="CustomizeDlg"><![CDATA[InstallMode = "Custom" OR InstallMode = "Change"]]></Publish>
+          <Publish Event="NewDialog" Value="MaintenanceTypeDlg"><![CDATA[InstallMode = "Repair"]]></Publish>
+          <Publish Event="NewDialog" Value="SetupTypeDlg"><![CDATA[InstallMode = "Typical" OR InstallMode = "Complete"]]></Publish>
+        </Control>
+        <Control Id="Text" Type="Text" X="25" Y="70" Width="320" Height="20">
+          <Text>Click Install to begin the installation.  If you want to review or change any of your installation settings, click Back.  Click Cancel to exit the wizard.</Text>
+        </Control>
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>The [Wizard] is ready to begin the [InstallMode] installation</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Ready to Install</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="VerifyRemoveDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes" TrackDiskSpace="yes">
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Back]">
+          <Publish Event="NewDialog" Value="MaintenanceTypeDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Remove" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="[ButtonText_Remove]">
+          <Publish Event="Remove" Value="All"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
+          <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"]]></Publish>
+          <Publish Event="EnableRollback" Value="False"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"]]></Publish>
+          <Publish Event="SpawnDialog" Value="OutOfDiskDlg"><![CDATA[(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="Text" Type="Text" X="25" Y="70" Width="320" Height="30">
+          <Text>Click Remove to remove [ProductName] from your computer.  If you want to review or change any of your installation settings, click Back.  Click Cancel to exit the wizard.</Text>
+        </Control>
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>You have chosen to remove the program from your computer.</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Remove [ProductName]</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="VerifyRepairDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes" TrackDiskSpace="yes">
+        <Control Id="Repair" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Repair]">
+          <Publish Event="ReinstallMode" Value="ecmus"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
+          <Publish Event="Reinstall" Value="All"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
+          <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)]]></Publish>
+          <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"]]></Publish>
+          <Publish Event="EnableRollback" Value="False"><![CDATA[OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"]]></Publish>
+          <Publish Event="SpawnDialog" Value="OutOfDiskDlg"><![CDATA[(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="[ButtonText_Back]">
+          <Publish Event="NewDialog" Value="MaintenanceTypeDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Text" Type="Text" X="25" Y="70" Width="320" Height="30">
+          <Text>Click Repair to repair the installation of [ProductName].  If you want to review or change any of your installation settings, click Back.  Click Cancel to exit the wizard.</Text>
+        </Control>
+        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>The [Wizard] is ready to begin the repair of [ProductName].</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+          <Text>[DlgTitleFont]Repair [ProductName]</Text>
+        </Control>
+      </Dialog>
+      <Dialog Id="WaitForCostingDlg" Y="10" Width="260" Height="85" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="Return" Type="PushButton" X="102" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Return]">
+          <Publish Event="EndDialog" Value="Exit"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30">
+          <Text>Please wait while the installer finishes determining your disk space requirements.</Text>
+        </Control>
+        <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="Exclamation icon" FixedSize="yes" IconSize="32" Text="[ExclamationIcon]" />
+      </Dialog>
+      <Dialog Id="WelcomeDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
+        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Next]">
+          <Publish Event="NewDialog" Value="LicenceAgreementDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="[ButtonText_Cancel]">
+          <Publish Event="SpawnDialog" Value="CancelDlg"><![CDATA[1]]></Publish>
+        </Control>
+        <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="[DialogBitmap]" />
+        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Back]" />
+        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
+        <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="30" Transparent="yes" NoPrefix="yes">
+          <Text>The [Wizard] will install [ProductName] on your computer.  Click Next to continue or Cancel to exit the [Wizard].</Text>
+        </Control>
+        <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
+          <Text>{\VerdanaBold13}Welcome to the [ProductName] [Wizard]</Text>
+        </Control>
+      </Dialog>
+      <Error Id="0">{{Fatal error: }}</Error>
+      <Error Id="1">{{Error [1]. }}</Error>
+      <Error Id="2">Warning [1]. </Error>
+      <Error Id="3" />
+      <Error Id="4">Info [1]. </Error>
+      <Error Id="5">The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is [1]. {{The arguments are: [2], [3], [4]}}</Error>
+      <Error Id="6" />
+      <Error Id="7">{{Disk full: }}</Error>
+      <Error Id="8">Action [Time]: [1]. [2]</Error>
+      <Error Id="9">[ProductName]</Error>
+      <Error Id="10">{[2]}{, [3]}{, [4]}</Error>
+      <Error Id="11">Message type: [1], Argument: [2]</Error>
+      <Error Id="12">=== Logging started: [Date]  [Time] ===</Error>
+      <Error Id="13">=== Logging stopped: [Date]  [Time] ===</Error>
+      <Error Id="14">Action start [Time]: [1].</Error>
+      <Error Id="15">Action ended [Time]: [1]. Return value [2].</Error>
+      <Error Id="16">Time remaining: {[1] minutes }{[2] seconds}</Error>
+      <Error Id="17">Out of memory. Shut down other applications before retrying.</Error>
+      <Error Id="18">Installer is no longer responding.</Error>
+      <Error Id="19">Installer stopped prematurely.</Error>
+      <Error Id="20">Please wait while Windows configures [ProductName]</Error>
+      <Error Id="21">Gathering required information...</Error>
+      <Error Id="22">Removing older versions of this application...</Error>
+      <Error Id="23">Preparing to remove older versions of this application...</Error>
+      <Error Id="32">{[ProductName] }Setup completed successfully.</Error>
+      <Error Id="33">{[ProductName] }Setup failed.</Error>
+      <Error Id="1101">Error reading from file: [2]. {{ System error [3].}}  Verify that the file exists and that you can access it.</Error>
+      <Error Id="1301">Cannot create the file '[2]'.  A directory with this name already exists.  Cancel the install and try installing to a different location.</Error>
+      <Error Id="1302">Please insert the disk: [2]</Error>
+      <Error Id="1303">The installer has insufficient privileges to access this directory: [2].  The installation cannot continue.  Log on as administrator or contact your system administrator.</Error>
+      <Error Id="1304">Error writing to file: [2].  Verify that you have access to that directory.</Error>
+      <Error Id="1305">Error reading from file [2]. {{ System error [3].}} Verify that the file exists and that you can access it.</Error>
+      <Error Id="1306">Another application has exclusive access to the file '[2]'.  Please shut down all other applications, then click Retry.</Error>
+      <Error Id="1307">There is not enough disk space to install this file: [2].  Free some disk space and click Retry, or click Cancel to exit.</Error>
+      <Error Id="1308">Source file not found: [2].  Verify that the file exists and that you can access it.</Error>
+      <Error Id="1309">Error reading from file: [3]. {{ System error [2].}}  Verify that the file exists and that you can access it.</Error>
+      <Error Id="1310">Error writing to file: [3]. {{ System error [2].}}  Verify that you have access to that directory.</Error>
+      <Error Id="1311">Source file not found{{(cabinet)}}: [2].  Verify that the file exists and that you can access it.</Error>
+      <Error Id="1312">Cannot create the directory '[2]'.  A file with this name already exists.  Please rename or remove the file and click retry, or click Cancel to exit.</Error>
+      <Error Id="1313">The volume [2] is currently unavailable.  Please select another.</Error>
+      <Error Id="1314">The specified path '[2]' is unavailable.</Error>
+      <Error Id="1315">Unable to write to the specified folder: [2].</Error>
+      <Error Id="1316">A network error occurred while attempting to read from the file: [2]</Error>
+      <Error Id="1317">An error occurred while attempting to create the directory: [2]</Error>
+      <Error Id="1318">A network error occurred while attempting to create the directory: [2]</Error>
+      <Error Id="1319">A network error occurred while attempting to open the source file cabinet: [2]</Error>
+      <Error Id="1320">The specified path is too long: [2]</Error>
+      <Error Id="1321">The Installer has insufficient privileges to modify this file: [2].</Error>
+      <Error Id="1322">A portion of the folder path '[2]' is invalid.  It is either empty or exceeds the length allowed by the system.</Error>
+      <Error Id="1323">The folder path '[2]' contains words that are not valid in folder paths.</Error>
+      <Error Id="1324">The folder path '[2]' contains an invalid character.</Error>
+      <Error Id="1325">'[2]' is not a valid short file name.</Error>
+      <Error Id="1326">Error getting file security: [3] GetLastError: [2]</Error>
+      <Error Id="1327">Invalid Drive: [2]</Error>
+      <Error Id="1328">Error applying patch to file [2].  It has probably been updated by other means, and can no longer be modified by this patch.  For more information contact your patch vendor.  {{System Error: [3]}}</Error>
+      <Error Id="1329">A file that is required cannot be installed because the cabinet file [2] is not digitally signed.  This may indicate that the cabinet file is corrupt.</Error>
+      <Error Id="1330">A file that is required cannot be installed because the cabinet file [2] has an invalid digital signature.  This may indicate that the cabinet file is corrupt.{{  Error [3] was returned by WinVerifyTrust.}}</Error>
+      <Error Id="1331">Failed to correctly copy [2] file: CRC error.</Error>
+      <Error Id="1332">Failed to correctly move [2] file: CRC error.</Error>
+      <Error Id="1333">Failed to correctly patch [2] file: CRC error.</Error>
+      <Error Id="1334">The file '[2]' cannot be installed because the file cannot be found in cabinet file '[3]'. This could indicate a network error, an error reading from the CD-ROM, or a problem with this package.</Error>
+      <Error Id="1335">The cabinet file '[2]' required for this installation is corrupt and cannot be used. This could indicate a network error, an error reading from the CD-ROM, or a problem with this package.</Error>
+      <Error Id="1336">There was an error creating a temporary file that is needed to complete this installation.{{  Folder: [3]. System error code: [2]}}</Error>
+      <Error Id="1401">Could not create key: [2]. {{ System error [3].}}  Verify that you have sufficient access to that key, or contact your support personnel. </Error>
+      <Error Id="1402">Could not open key: [2]. {{ System error [3].}}  Verify that you have sufficient access to that key, or contact your support personnel. </Error>
+      <Error Id="1403">Could not delete value [2] from key [3]. {{ System error [4].}}  Verify that you have sufficient access to that key, or contact your support personnel. </Error>
+      <Error Id="1404">Could not delete key [2]. {{ System error [3].}}  Verify that you have sufficient access to that key, or contact your support personnel. </Error>
+      <Error Id="1405">Could not read value [2] from key [3]. {{ System error [4].}}  Verify that you have sufficient access to that key, or contact your support personnel. </Error>
+      <Error Id="1406">Could not write value [2] to key [3]. {{ System error [4].}}  Verify that you have sufficient access to that key, or contact your support personnel.</Error>
+      <Error Id="1407">Could not get value names for key [2]. {{ System error [3].}}  Verify that you have sufficient access to that key, or contact your support personnel.</Error>
+      <Error Id="1408">Could not get sub key names for key [2]. {{ System error [3].}}  Verify that you have sufficient access to that key, or contact your support personnel.</Error>
+      <Error Id="1409">Could not read security information for key [2]. {{ System error [3].}}  Verify that you have sufficient access to that key, or contact your support personnel.</Error>
+      <Error Id="1410">Could not increase the available registry space. [2] KB of free registry space is required for the installation of this application.</Error>
+      <Error Id="1500">Another installation is in progress. You must complete that installation before continuing this one.</Error>
+      <Error Id="1501">Error accessing secured data. Please make sure the Windows Installer is configured properly and try the install again.</Error>
+      <Error Id="1502">User '[2]' has previously initiated an install for product '[3]'.  That user will need to run that install again before they can use that product.  Your current install will now continue.</Error>
+      <Error Id="1503">User '[2]' has previously initiated an install for product '[3]'.  That user will need to run that install again before they can use that product.</Error>
+      <Error Id="1601">Out of disk space -- Volume: '[2]'; required space: [3] KB; available space: [4] KB.  Free some disk space and retry.</Error>
+      <Error Id="1602">Are you sure you want to cancel?</Error>
+      <Error Id="1603">The file [2][3] is being held in use{ by the following process: Name: [4], Id: [5], Window Title: '[6]'}.  Close that application and retry.</Error>
+      <Error Id="1604">The product '[2]' is already installed, preventing the installation of this product.  The two products are incompatible.</Error>
+      <Error Id="1605">There is not enough disk space on the volume '[2]' to continue the install with recovery enabled. [3] KB are required, but only [4] KB are available. Click Ignore to continue the install without saving recovery information, click Retry to check for available space again, or click Cancel to quit the installation.</Error>
+      <Error Id="1606">Could not access network location [2].</Error>
+      <Error Id="1607">The following applications should be closed before continuing the install:</Error>
+      <Error Id="1608">Could not find any previously installed compliant products on the machine for installing this product.</Error>
+      <Error Id="1609">An error occurred while applying security settings. [2] is not a valid user or group. This could be a problem with the package, or a problem connecting to a domain controller on the network. Check your network connection and click Retry, or Cancel to end the install. {{Unable to locate the user's SID, system error [3]}}</Error>
+      <Error Id="1701">The key [2] is not valid.  Verify that you entered the correct key.</Error>
+      <Error Id="1702">The installer must restart your system before configuration of [2] can continue.  Click Yes to restart now or No if you plan to manually restart later.</Error>
+      <Error Id="1703">You must restart your system for the configuration changes made to [2] to take effect. Click Yes to restart now or No if you plan to manually restart later.</Error>
+      <Error Id="1704">An installation for [2] is currently suspended.  You must undo the changes made by that installation to continue.  Do you want to undo those changes?</Error>
+      <Error Id="1705">A previous installation for this product is in progress.  You must undo the changes made by that installation to continue.  Do you want to undo those changes?</Error>
+      <Error Id="1706">An installation package for the product [2] cannot be found. Try the installation again using a valid copy of the installation package '[3]'.</Error>
+      <Error Id="1707">Installation completed successfully.</Error>
+      <Error Id="1708">Installation failed.</Error>
+      <Error Id="1709">Product: [2] -- [3]</Error>
+      <Error Id="1710">You may either restore your computer to its previous state or continue the install later. Would you like to restore?</Error>
+      <Error Id="1711">An error occurred while writing installation information to disk.  Check to make sure enough disk space is available, and click Retry, or Cancel to end the install.</Error>
+      <Error Id="1712">One or more of the files required to restore your computer to its previous state could not be found.  Restoration will not be possible.</Error>
+      <Error Id="1713">[2] cannot install one of its required products. Contact your technical support group.  {{System Error: [3].}}</Error>
+      <Error Id="1714">The older version of [2] cannot be removed.  Contact your technical support group.  {{System Error [3].}}</Error>
+      <Error Id="1715">Installed [2]</Error>
+      <Error Id="1716">Configured [2]</Error>
+      <Error Id="1717">Removed [2]</Error>
+      <Error Id="1718">File [2] was rejected by digital signature policy.</Error>
+      <Error Id="1719">The Windows Installer Service could not be accessed. This can occur if you are running Windows in safe mode, or if the Windows Installer is not correctly installed. Contact your support personnel for assistance.</Error>
+      <Error Id="1720">There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor.  {{Custom action [2] script error [3], [4]: [5] Line [6], Column [7], [8] }}</Error>
+      <Error Id="1721">There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. {{Action: [2], location: [3], command: [4] }}</Error>
+      <Error Id="1722">There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.  {{Action [2], location: [3], command: [4] }}</Error>
+      <Error Id="1723">There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor.  {{Action [2], entry: [3], library: [4] }}</Error>
+      <Error Id="1724">Removal completed successfully.</Error>
+      <Error Id="1725">Removal failed.</Error>
+      <Error Id="1726">Advertisement completed successfully.</Error>
+      <Error Id="1727">Advertisement failed.</Error>
+      <Error Id="1728">Configuration completed successfully.</Error>
+      <Error Id="1729">Configuration failed.</Error>
+      <Error Id="1730">You must be an Administrator to remove this application. To remove this application, you can log on as an Administrator, or contact your technical support group for assistance.</Error>
+      <Error Id="1731">The source installation package for the product [2] is out of sync with the client package. Try the installation again using a valid copy of the installation package '[3]'.</Error>
+      <Error Id="1732">In order to complete the installation of [2], you must restart the computer. Other users are currently logged on to this computer, and restarting may cause them to lose their work. Do you want to restart now?</Error>
+      <Error Id="1801">The path [2] is not valid.  Please specify a valid path.</Error>
+      <Error Id="1802">Out of memory. Shut down other applications before retrying.</Error>
+      <Error Id="1803">There is no disk in drive [2]. Please insert one and click Retry, or click Cancel to go back to the previously selected volume.</Error>
+      <Error Id="1804">There is no disk in drive [2]. Please insert one and click Retry, or click Cancel to return to the browse dialog and select a different volume.</Error>
+      <Error Id="1805">The folder [2] does not exist.  Please enter a path to an existing folder.</Error>
+      <Error Id="1806">You have insufficient privileges to read this folder.</Error>
+      <Error Id="1807">A valid destination folder for the install could not be determined.</Error>
+      <Error Id="1901">Error attempting to read from the source install database: [2].</Error>
+      <Error Id="1902">Scheduling reboot operation: Renaming file [2] to [3]. Must reboot to complete operation.</Error>
+      <Error Id="1903">Scheduling reboot operation: Deleting file [2]. Must reboot to complete operation.</Error>
+      <Error Id="1904">Module [2] failed to register.  HRESULT [3].  Contact your support personnel.</Error>
+      <Error Id="1905">Module [2] failed to unregister.  HRESULT [3].  Contact your support personnel.</Error>
+      <Error Id="1906">Failed to cache package [2]. Error: [3]. Contact your support personnel.</Error>
+      <Error Id="1907">Could not register font [2].  Verify that you have sufficient permissions to install fonts, and that the system supports this font.</Error>
+      <Error Id="1908">Could not unregister font [2]. Verify that you that you have sufficient permissions to remove fonts.</Error>
+      <Error Id="1909">Could not create Shortcut [2]. Verify that the destination folder exists and that you can access it.</Error>
+      <Error Id="1910">Could not remove Shortcut [2]. Verify that the shortcut file exists and that you can access it.</Error>
+      <Error Id="1911">Could not register type library for file [2].  Contact your support personnel.</Error>
+      <Error Id="1912">Could not unregister type library for file [2].  Contact your support personnel.</Error>
+      <Error Id="1913">Could not update the ini file [2][3].  Verify that the file exists and that you can access it.</Error>
+      <Error Id="1914">Could not schedule file [2] to replace file [3] on reboot.  Verify that you have write permissions to file [3].</Error>
+      <Error Id="1915">Error removing ODBC driver manager, ODBC error [2]: [3]. Contact your support personnel.</Error>
+      <Error Id="1916">Error installing ODBC driver manager, ODBC error [2]: [3]. Contact your support personnel.</Error>
+      <Error Id="1917">Error removing ODBC driver: [4], ODBC error [2]: [3]. Verify that you have sufficient privileges to remove ODBC drivers.</Error>
+      <Error Id="1918">Error installing ODBC driver: [4], ODBC error [2]: [3]. Verify that the file [4] exists and that you can access it.</Error>
+      <Error Id="1919">Error configuring ODBC data source: [4], ODBC error [2]: [3]. Verify that the file [4] exists and that you can access it.</Error>
+      <Error Id="1920">Service '[2]' ([3]) failed to start.  Verify that you have sufficient privileges to start system services.</Error>
+      <Error Id="1921">Service '[2]' ([3]) could not be stopped.  Verify that you have sufficient privileges to stop system services.</Error>
+      <Error Id="1922">Service '[2]' ([3]) could not be deleted.  Verify that you have sufficient privileges to remove system services.</Error>
+      <Error Id="1923">Service '[2]' ([3]) could not be installed.  Verify that you have sufficient privileges to install system services.</Error>
+      <Error Id="1924">Could not update environment variable '[2]'.  Verify that you have sufficient privileges to modify environment variables.</Error>
+      <Error Id="1925">You do not have sufficient privileges to complete this installation for all users of the machine.  Log on as administrator and then retry this installation.</Error>
+      <Error Id="1926">Could not set file security for file '[3]'. Error: [2].  Verify that you have sufficient privileges to modify the security permissions for this file.</Error>
+      <Error Id="1927">Component Services (COM+ 1.0) are not installed on this computer.  This installation requires Component Services in order to complete successfully.  Component Services are available on Windows 2000.</Error>
+      <Error Id="1928">Error registering COM+ Application.  Contact your support personnel for more information.</Error>
+      <Error Id="1929">Error unregistering COM+ Application.  Contact your support personnel for more information.</Error>
+      <Error Id="1930">The description for service '[2]' ([3]) could not be changed.</Error>
+      <Error Id="1931">The Windows Installer service cannot update the system file [2] because the file is protected by Windows.  You may need to update your operating system for this program to work correctly. {{Package version: [3], OS Protected version: [4]}}</Error>
+      <Error Id="1932">The Windows Installer service cannot update the protected Windows file [2]. {{Package version: [3], OS Protected version: [4], SFP Error: [5]}}</Error>
+      <Error Id="1933">The Windows Installer service cannot update one or more protected Windows files. {{SFP Error: [2].  List of protected files:\r\n[3]}}</Error>
+      <Error Id="1934">User installations are disabled via policy on the machine.</Error>
+      <Error Id="1935">An error occurred during the installation of assembly '[6]'. Please refer to Help and Support for more information. HRESULT: [3]. {{assembly interface: [4], function: [5], component: [2]}}</Error>
+      <Error Id="1936">An error occurred during the installation of assembly '[6]'. The assembly is not strongly named or is not signed with the minimal key length. HRESULT: [3]. {{assembly interface: [4], function: [5], component: [2]}}</Error>
+      <Error Id="1937">An error occurred during the installation of assembly '[6]'. The signature or catalog could not be verified or is not valid. HRESULT: [3]. {{assembly interface: [4], function: [5], component: [2]}}</Error>
+      <Error Id="1938">An error occurred during the installation of assembly '[6]'. One or more modules of the assembly could not be found. HRESULT: [3]. {{assembly interface: [4], function: [5], component: [2]}}</Error>
+      <AdminUISequence>
+        <Show Dialog="ProgressDlg" After="AdminWelcomeDlg" />
+        <Show Dialog="AdminWelcomeDlg" After="CostFinalize" />
+        <Show Dialog="ExitDialog" OnExit="success" />
+        <Show Dialog="UserExit" OnExit="cancel" />
+        <Show Dialog="FatalError" OnExit="error" />
+        <Show Dialog="PrepareDlg" Before="CostInitialize" />
+      </AdminUISequence>
+      <InstallUISequence>
+        <Show Dialog="UserExit" OnExit="cancel" />
+        <Show Dialog="WelcomeDlg" After="MigrateFeatureStates"><![CDATA[NOT Installed]]></Show>
+        <Show Dialog="ProgressDlg" After="MaintenanceWelcomeDlg" />
+        <Show Dialog="MaintenanceWelcomeDlg" After="ResumeDlg"><![CDATA[Installed AND NOT RESUME AND NOT Preselected]]></Show>
+        <Show Dialog="PrepareDlg" After="LaunchConditions" />
+        <Show Dialog="FatalError" OnExit="error" />
+        <Show Dialog="ExitDialog" OnExit="success" />
+        <Show Dialog="ResumeDlg" After="WelcomeDlg"><![CDATA[Installed AND (RESUME OR Preselected)]]></Show>
+      </InstallUISequence>
+    </UI>
+    <Property Id="ButtonText_No"><![CDATA[&No]]></Property>
+    <Property Id="ButtonText_Install"><![CDATA[&Install]]></Property>
+    <Property Id="ButtonText_Next"><![CDATA[&Next >]]></Property>
+    <Property Id="Setup"><![CDATA[Setup]]></Property>
+    <Property Id="ButtonText_Browse"><![CDATA[Br&owse]]></Property>
+    <Property Id="CustomSetupIcon"><![CDATA[custicon]]></Property>
+    <Property Id="RepairIcon"><![CDATA[repairic]]></Property>
+    <Property Id="ExclamationIcon"><![CDATA[exclamic]]></Property>
+    <Property Id="ButtonText_Repair"><![CDATA[&Repair]]></Property>
+    <Property Id="ButtonText_Back"><![CDATA[< &Back]]></Property>
+    <Property Id="InstallMode"><![CDATA[Typical]]></Property>
+    <Property Id="Progress2"><![CDATA[installs]]></Property>
+    <Property Id="Progress1"><![CDATA[Installing]]></Property>
+    <Property Id="Wizard"><![CDATA[Setup Wizard]]></Property>
+    <Property Id="RemoveIcon"><![CDATA[removico]]></Property>
+    <Property Id="ButtonText_Yes"><![CDATA[&Yes]]></Property>
+    <Property Id="ButtonText_Ignore"><![CDATA[&Ignore]]></Property>
+    <Property Id="ProductID"><![CDATA[none]]></Property>
+    <Property Id="ButtonText_Reset"><![CDATA[&Reset]]></Property>
+    <Property Id="ButtonText_Remove"><![CDATA[&Remove]]></Property>
+    <Property Id="ShowUserRegistrationDlg"><![CDATA[0]]></Property>
+    <Property Id="ButtonText_Exit"><![CDATA[&Exit]]></Property>
+    <Property Id="ButtonText_Return"><![CDATA[&Return]]></Property>
+    <Property Id="ButtonText_OK"><![CDATA[OK]]></Property>
+    <Property Id="CompleteSetupIcon"><![CDATA[completi]]></Property>
+    <Property Id="ButtonText_Resume"><![CDATA[&Resume]]></Property>
+    <Property Id="ARPHELPLINK"><![CDATA[http://www.microsoft.com/management]]></Property>
+    <Property Id="InstallerIcon"><![CDATA[insticon]]></Property>
+    <Property Id="ButtonText_Finish"><![CDATA[&Finish]]></Property>
+    <Property Id="PROMPTROLLBACKCOST"><![CDATA[P]]></Property>
+    <Property Id="PIDTemplate"><![CDATA[12345<###-%%%%%%%>@@@@@]]></Property>
+    <Property Id="DlgTitleFont"><![CDATA[{&DlgFontBold8}]]></Property>
+    <Property Id="ButtonText_Cancel"><![CDATA[Cancel]]></Property>
+    <Property Id="INSTALLLEVEL"><![CDATA[3]]></Property>
+    <Property Id="InfoIcon"><![CDATA[info]]></Property>
+    <Property Id="ButtonText_Retry"><![CDATA[&Retry]]></Property>
+    <Property Id="IAgree"><![CDATA[No]]></Property>
+    <Property Id="ComponentDownload"><![CDATA[ftp://anonymous@microsoft.com/components/]]></Property>
+    <Property Id="BannerBitmap"><![CDATA[bannrbmp]]></Property>
+    <Property Id="DialogBitmap"><![CDATA[dlgbmp]]></Property>
+    <InstallExecuteSequence>
+      <RemoveExistingProducts After="InstallFinalize" />
+      <Custom Action="GenerateConfFiles" Before="InstallServices">$conf&gt;2</Custom>
+    </InstallExecuteSequence>
+    <Binary Id="bannrbmp" src="Binary\bannrbmp.ibd" />
+    <Binary Id="completi" src="Binary\completi.ibd" />
+    <Binary Id="custicon" src="Binary\custicon.ibd" />
+    <Binary Id="dlgbmp" src="Binary\dlgbmp.ibd" />
+    <Binary Id="exclamic" src="Binary\exclamic.ibd" />
+    <Binary Id="info" src="Binary\info.ibd" />
+    <Binary Id="insticon" src="Binary\insticon.ibd" />
+    <Binary Id="New" src="Binary\New.ibd" />
+    <Binary Id="removico" src="Binary\removico.ibd" />
+    <Binary Id="repairic" src="Binary\repairic.ibd" />
+    <Binary Id="Up" src="Binary\Up.ibd" />
+    		
+	</Product>
+</Wix>
Index: ClamAVSetup/ClamAVSetup.wixproj
===================================================================
--- ClamAVSetup/ClamAVSetup.wixproj	(.../vendor/clamav/current)	(revision 0)
+++ ClamAVSetup/ClamAVSetup.wixproj	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,29 @@
+﻿<?xml version="1.0" encoding="utf-8" ?>
+<VisualStudioProject>
+    <WindowsInstallerXML
+        ProductVersion="2.0.2722.0"
+        ProjectGuid="{0876E070-1A60-4267-A7CD-37F6D525E9CE}"
+        SchemaVersion="1.0"
+    >
+        <BuildSettings
+            OutputName="ClamAVSetup"
+            OutputType="MSI"
+        />
+        <Configurations>
+            <Configuration
+                Name="Debug"
+                RelativeOutputDirectory="..\bin"
+            />
+            <Configuration
+                Name="Release"
+                RelativeOutputDirectory="..\bin"
+            />
+        </Configurations>
+        <WixlibReferences />
+        <Files>
+            <File
+                RelativePath="ClamAVSetup.wxs"
+            />
+        </Files>
+    </WindowsInstallerXML>
+</VisualStudioProject>
Index: clamdscan/client.c
===================================================================
--- clamdscan/client.c	(.../vendor/clamav/current)	(revision 845)
+++ clamdscan/client.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -21,17 +21,26 @@
 #endif
 
 #include <stdio.h>
-#include <unistd.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <errno.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#include <direct.h>
+#include <windows.h>
+#include <sys/utime.h>
+#else
+#define closesocket close
+#include <unistd.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <utime.h>
-#include <errno.h>
+#endif
 
 #ifdef HAVE_SYS_UIO_H
 #include <sys/uio.h>
@@ -47,6 +56,7 @@
 #include "misc.h"
 #include "str.h"
 #include "strrcpy.h" /* libclamav */
+#include "clamav.h"
 
 #ifdef PF_INET
 # define SOCKET_INET	PF_INET
@@ -59,10 +69,109 @@
 void move_infected(const char *filename, const struct optstruct *opt);
 int notremoved = 0, notmoved = 0;
 
+#ifdef C_WIN32
+/* Win32 does not support stream I/O on sockets, so we do a buffering/fgets
+   implementation here. */
+typedef struct sockbuf
+{
+	char data[FILEBUFF];
+	int pos, count;
+	int fd;
+} sockbuf;
+
+static void sockbuf_init(sockbuf *buf, int fd)
+{
+	buf->count = buf->pos = 0;
+	buf->fd = fd;
+}
+
+static void sockbuf_fill(sockbuf *buf)
+{
+	buf->count = recv(buf->fd, buf->data, sizeof(buf->data), 0);
+	if (buf->count < 0)
+		buf->count = 0;
+	buf->pos = 0;
+}
+
+static inline int sockbuf_getc(sockbuf *buf)
+{
+	if (buf->pos >= buf->count) {
+		sockbuf_fill(buf);
+	}
+	if (buf->pos >= buf->count) {
+		return EOF;
+	}
+	return buf->data[buf->pos++];
+}
+
+static char *sockgets(char *buf, int count, sockbuf *sbuf)
+{
+	char *org = buf;
+
+	if (count <= 0)
+		return NULL;
+
+	while (--count) {
+		int ch = sockbuf_getc(sbuf);
+		if (ch == EOF) {
+			if (org == buf)
+				return NULL;
+			break;
+		}
+		*buf++ = ch;
+		if (ch == '\n')
+			break;
+	}
+	*buf = '\0';
+	return org;
+}
+
 int dsresult(int sockd, const struct optstruct *opt)
 {
 	int infected = 0, waserror = 0;
 	char buff[4096], *pt;
+	sockbuf sbuf;
+
+	sockbuf_init(&sbuf, sockd);
+    while(sockgets(buff, sizeof(buff), &sbuf)) {
+	if(strstr(buff, "FOUND\n")) {
+	    infected++;
+	    logg("%s", buff);
+	    mprintf("%s", buff);
+	    if(optl(opt, "move")) {
+		pt = strrchr(buff, ':');
+		*pt = 0;
+		move_infected(buff, opt);
+
+	    } else if(optl(opt, "remove")) {
+		pt = strrchr(buff, ':');
+		*pt = 0;
+		if(unlink(buff)) {
+		    mprintf("%s: Can't remove.\n", buff);
+		    logg("%s: Can't remove.\n", buff);
+		    notremoved++;
+		} else {
+		    mprintf("%s: Removed.\n", buff);
+		    logg("%s: Removed.\n", buff);
+		}
+	    }
+	}
+
+	if(strstr(buff, "ERROR\n")) {
+	    logg("%s", buff);
+	    mprintf("%s", buff);
+	    waserror = 1;
+	}
+    }
+
+    return infected ? infected : (waserror ? -1 : 0);
+}
+
+#else
+int dsresult(int sockd, const struct optstruct *opt)
+{
+	int infected = 0, waserror = 0;
+	char buff[4096], *pt;
 	FILE *fd;
 
 
@@ -112,6 +221,7 @@
 
     return infected ? infected : (waserror ? -1 : 0);
 }
+#endif
 
 int dsfile(int sockd, const char *filename, const struct optstruct *opt)
 {
@@ -122,7 +232,7 @@
     scancmd = mcalloc(strlen(filename) + 20, sizeof(char));
     sprintf(scancmd, "CONTSCAN %s", filename);
 
-    if(write(sockd, scancmd, strlen(scancmd)) <= 0) {
+    if(send(sockd, scancmd, strlen(scancmd), 0) <= 0) {
 	mprintf("@Can't write to the socket.\n");
 	free(scancmd);
 	return -1;
@@ -199,15 +309,14 @@
 #endif
 	char buff[4096], *pt;
 
-
-    if(write(sockd, "STREAM", 6) <= 0) {
+    if(send(sockd, "STREAM", 6, 0) <= 0) {
 	mprintf("@Can't write to the socket.\n");
 	return 2;
     }
 
     memset(buff, 0, sizeof(buff));
     while(loopw) {
-	read(sockd, buff, sizeof(buff));
+	recv(sockd, buff, sizeof(buff) - 1, 0);
 	if((pt = strstr(buff, "PORT"))) {
 	    pt += 5;
 	    sscanf(pt, "%d", &port);
@@ -223,7 +332,7 @@
 
     /* connect to clamd */
 
-    if((wsockd = socket(SOCKET_INET, SOCK_STREAM, 0)) < 0) {
+    if((wsockd = socket(SOCKET_INET, SOCK_STREAM, 0)) == -1) {
 	perror("socket()");
 	mprintf("@Can't create the socket.\n");
 	return -1;
@@ -252,23 +361,23 @@
     }
 
     if(connect(wsockd, (struct sockaddr *) &server, sizeof(struct sockaddr_in)) < 0) {
-	close(wsockd);
+	closesocket(wsockd);
 	perror("connect()");
 	mprintf("@Can't connect to clamd [port: %d].\n", port);
 	return -1;
     }
 
     while((bread = read(0, buff, sizeof(buff))) > 0) {
-	if(write(wsockd, buff, bread) <= 0) {
+	if(send(wsockd, buff, bread, 0) <= 0) {
 	    mprintf("@Can't write to the socket.\n");
-	    close(wsockd);
+	    closesocket(wsockd);
 	    return -1;
 	}
     }
-    close(wsockd);
+    closesocket(wsockd);
 
     memset(buff, 0, sizeof(buff));
-    while((bread = read(sockd, buff, sizeof(buff))) > 0) {
+    while((bread = recv(sockd, buff, sizeof(buff) - 1, 0)) > 0) {
 	mprintf("%s", buff);
 	if(strstr(buff, "FOUND\n")) {
 	    infected++;
@@ -302,7 +411,7 @@
 	    mprintf("@Can't get absolute pathname of current working directory.\n");
 	    return NULL;
 	}
-	sprintf(fullpath, "%s/%s", cwd, filename);
+	sprintf(fullpath, "%s" PATH_SEPARATOR "%s", cwd, filename);
 #endif
     }
 
@@ -311,33 +420,43 @@
 
 int dconnect(const struct optstruct *opt)
 {
+#ifndef C_WIN32
 	struct sockaddr_un server;
+#endif
 	struct sockaddr_in server2;
 	struct hostent *he;
 	struct cfgstruct *copt, *cpt;
 	const char *clamav_conf = getargl(opt, "config-file");
+	char *clamav_conf_t = NULL;
 	int sockd;
 
 
-    if(!clamav_conf)
-	clamav_conf = DEFAULT_CFG;
+	if(!clamav_conf) {
+		clamav_conf = clamav_conf_t = cl_retconfpath("clamd.conf");
+	}
 
-    if((copt = parsecfg(clamav_conf, 1)) == NULL) {
+    if(!clamav_conf || (copt = parsecfg(clamav_conf, 1)) == NULL) {
 	mprintf("@Can't parse the configuration file.\n");
 	return -1;
     }
+	free(clamav_conf_t);
 
+#ifndef C_WIN32
     memset((char *) &server, 0, sizeof(server));
+#endif
     memset((char *) &server2, 0, sizeof(server2));
 
     /* Set default address to connect to */
     server2.sin_addr.s_addr = inet_addr("127.0.0.1");    
 
-    if(cfgopt(copt, "TCPSocket") && cfgopt(copt, "LocalSocket")) {
-	mprintf("@Clamd is not configured properly.\n");
-	return -1;
-    } else if((cpt = cfgopt(copt, "LocalSocket"))) {
+	if(cfgopt(copt, "TCPSocket") && cfgopt(copt, "LocalSocket")) {
+		mprintf("@Clamd is not configured properly.\n");
+		return -1;
+	}
 
+#ifndef C_WIN32
+    else if((cpt = cfgopt(copt, "LocalSocket"))) {
+
 	server.sun_family = AF_UNIX;
 	strncpy(server.sun_path, cpt->strarg, sizeof(server.sun_path));
 
@@ -348,15 +467,17 @@
 	}
 
 	if(connect(sockd, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) {
-	    close(sockd);
+	    closesocket(sockd);
 	    perror("connect()");
 	    mprintf("@Can't connect to clamd.\n");
 	    return -1;
 	}
+	}
+#endif
 
-    } else if((cpt = cfgopt(copt, "TCPSocket"))) {
+    else if((cpt = cfgopt(copt, "TCPSocket"))) {
 
-	if((sockd = socket(SOCKET_INET, SOCK_STREAM, 0)) < 0) {
+	if((sockd = socket(SOCKET_INET, SOCK_STREAM, 0)) == -1) {
 	    perror("socket()");
 	    mprintf("@Can't create the socket.\n");
 	    return -1;
@@ -367,7 +488,7 @@
 
 	if((cpt = cfgopt(copt, "TCPAddr"))) {
 	    if ((he = gethostbyname(cpt->strarg)) == 0) {
-		close(sockd);
+		closesocket(sockd);
 		perror("gethostbyname()");
 		mprintf("@Can't lookup clamd hostname.\n");
 		return -1;
@@ -375,8 +496,8 @@
 	    server2.sin_addr = *(struct in_addr *) he->h_addr_list[0];
 	}
 
-	if(connect(sockd, (struct sockaddr *) &server2, sizeof(struct sockaddr_in)) < 0) {
-	    close(sockd);
+	if(connect(sockd, (struct sockaddr *) &server2, sizeof(struct sockaddr_in)) == -1) {
+	    closesocket(sockd);
 	    perror("connect()");
 	    mprintf("@Can't connect to clamd.\n");
 	    return -1;
@@ -416,7 +537,7 @@
 	else
 	    errors++;
 
-	close(sockd);
+	closesocket(sockd);
 
 #if defined(ENABLE_FD_PASSING) && defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) && !defined(C_CYGWIN)
     } else if(!strcmp(opt->filename, "-")) { /* scan data from stdin */
@@ -428,7 +549,7 @@
 	else
 	    errors++;
 
-	close(sockd);
+	closesocket(sockd);
 #else
     } else if(!strcmp(opt->filename, "-")) { /* scan data from stdin */
 	if((sockd = dconnect(opt)) < 0)
@@ -439,7 +560,7 @@
 	else
 	    errors++;
 
-	close(sockd);
+	closesocket(sockd);
 #endif
 
     } else {
@@ -453,7 +574,11 @@
 		perror(fullpath);
 		errors++;
 	    } else {
+#ifdef C_WIN32
 		if(strlen(fullpath) < 2 || (fullpath[0] != '/' && fullpath[0] != '\\' && fullpath[1] != ':')) {
+#else
+		if(strlen(fullpath) < 1 || fullpath[0] != '/') {
+#endif
 		    fullpath = abpath(thefilename);
 		    free(thefilename);
 
@@ -474,7 +599,7 @@
 			else
 			    errors++;
 
-			close(sockd);
+			closesocket(sockd);
 			break;
 
 		    default:
@@ -518,6 +643,9 @@
 	return;
     }
 
+#ifdef C_WIN32
+    if(!(tmp = strrchr(filename, '\\')))
+#endif
     if(!(tmp = strrchr(filename, '/')))
 	tmp = (char *) filename;
 
@@ -535,7 +663,7 @@
         return;
     }
 
-    strcat(movefilename, "/");
+    strcat(movefilename, PATH_SEPARATOR);
 
     if(!(strcat(movefilename, tmp))) {
         mprintf("@strcat() returned NULL\n");
@@ -545,6 +673,7 @@
     }
 
     if(!stat(movefilename, &mfstat)) {
+#ifndef C_WIN32
         if(fstat.st_ino == mfstat.st_ino) { /* It's the same file*/
             mprintf("File excluded '%s'\n", filename);
             logg("File excluded '%s'\n", filename);
@@ -552,6 +681,9 @@
             free(movefilename);
             return;
         } else {
+#else
+		{
+#endif
             /* file exists - try to append an ordinal number to the
 	     * quranatined file in an attempt not to overwrite existing
 	     * files in quarantine  
@@ -579,7 +711,9 @@
 	}
 
 	chmod(movefilename, fstat.st_mode);
+#ifndef C_WIN32
 	chown(movefilename, fstat.st_uid, fstat.st_gid);
+#endif
 
 	ubuf.actime = fstat.st_atime;
 	ubuf.modtime = fstat.st_mtime;
Index: clamdscan/clamdscan.c
===================================================================
--- clamdscan/clamdscan.c	(.../vendor/clamav/current)	(revision 845)
+++ clamdscan/clamdscan.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,11 +23,18 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
-#include <sys/time.h>
 #include <time.h>
 #include <signal.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#include <fcntl.h>
+#include <w32_time.h>
+#else
+#include <unistd.h>
+#include <sys/time.h>
+#endif
+
 #include "options.h"
 #include "others.h"
 #include "shared.h"
@@ -50,6 +57,11 @@
 	time_t starttime;
 
 
+#ifdef C_WIN32
+	/* For the stream mode, we need stdin in binary, this is the only way to do it */
+	_setmode(0, _O_BINARY);
+#endif
+
     /* initialize some important variables */
 
     if(optc(opt, 'v')) {
Index: clamdscan/clamdscan.vcproj
===================================================================
--- clamdscan/clamdscan.vcproj	(.../vendor/clamav/current)	(revision 0)
+++ clamdscan/clamdscan.vcproj	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="clamdscan"
+	ProjectGUID="{ED8E81E5-94F5-4562-B403-B1EE2474B7EC}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".,..,..\libclamav,..\shared,..\clamscan"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib pthreadVC2.lib"
+				OutputFile="$(OutDir)\$(ProjectName)D.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName)D.pdb"
+				SubSystem="1"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".,..,..\libclamav,..\shared,..\clamscan"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib pthreadVC2.lib"
+				OutputFile="$(OutDir)\$(ProjectName).exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\clamdscan.c"
+				>
+			</File>
+			<File
+				RelativePath=".\client.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\client.h"
+				>
+			</File>
+			<File
+				RelativePath=".\defaults.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="shared"
+			>
+			<File
+				RelativePath="..\shared\cfgparser.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\cfgparser.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\getopt.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\memory.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\memory.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\misc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\misc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\clamscan\options.c"
+				>
+			</File>
+			<File
+				RelativePath="..\clamscan\options.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\output.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\output.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes on: clamdscan/clamdscan.vcproj
___________________________________________________________________
Name: svn:eol-style
   + CRLF

Index: conf/clamd.conf
===================================================================
--- conf/clamd.conf	(.../vendor/clamav/current)	(revision 0)
+++ conf/clamd.conf	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,286 @@
+##
+## Example config file for the Clam AV daemon
+## Please read the clamd.conf(5) manual before editing this file.
+##
+
+
+# Comment or remove the line below.
+#Example
+
+# Uncomment this option to enable logging.
+# LogFile must be writable for the user running daemon.
+# A full path is required.
+# Default: disabled
+LogFile c:\granposium\clamav\log\clamd.log
+
+# By default the log file is locked for writing - the lock protects against
+# running clamd multiple times (if want to run another clamd, please
+# copy the configuration file, change the LogFile variable, and run
+# the daemon with --config-file option).
+# This option disables log file locking.
+# Default: disabled
+#LogFileUnlock
+
+# Maximal size of the log file.
+# Value of 0 disables the limit.
+# You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes)
+# and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). To specify the size
+# in bytes just don't use modifiers.
+# Default: 1M
+LogFileMaxSize 1M
+
+# Log time with each message.
+# Default: disabled
+LogTime
+
+# Also log clean files. Useful in debugging but drastically increases the
+# log size.
+# Default: disabled
+#LogClean
+
+# Use system logger (can work together with LogFile).
+# Default: disabled
+#LogSyslog
+
+# Specify the type of syslog messages - please refer to 'man syslog'
+# for facility names.
+# Default: LOG_LOCAL6
+#LogFacility LOG_MAIL
+
+# Enable verbose logging.
+# Default: disabled
+#LogVerbose
+
+# This option allows you to save a process identifier of the listening
+# daemon (main thread).
+# Default: disabled
+#PidFile c:\clamav-devel\clamd.pid
+
+# Optional path to the global temporary directory.
+# Default: system specific (usually /tmp or /var/tmp).
+# TemporaryDirectory c:\clamav-devel\tmp
+
+# Path to the database directory.
+# Default: hardcoded (depends on installation options)
+DatabaseDirectory c:\granposium\clamav\db
+
+# The daemon works in a local OR a network mode. Due to security reasons we
+# recommend the local mode.
+
+# Path to a local socket file the daemon will listen on.
+# Default: disabled
+# LocalSocket /cygdrive/c/clamav-devel/clamd.sock
+
+# Remove stale socket after unclean shutdown.
+# Default: disabled
+FixStaleSocket
+
+
+# UNCOMMENT THE FOLLOWING TWO OPTIONS IF YOU WANT
+# CLAMAV TO RUN IN TCP/IP MODE, WHICH MAY SOLVE SOME
+# STABILITY ISSUES ON SOME VERSIONS OF WINDOWS
+#====================================================
+
+# TCP port address.
+# Default: disabled
+TCPSocket 3310
+
+# TCP address.
+# By default we bind to INADDR_ANY, probably not wise.
+# Enable the following to provide some degree of protection
+# from the outside world.
+# Default: disabled
+TCPAddr 127.0.0.1
+
+#====================================================
+
+# Maximum length the queue of pending connections may grow to.
+# Default: 15
+MaxConnectionQueueLength 15
+
+# Clamd uses FTP-like protocol to receive data from remote clients.
+# If you are using clamav-milter to balance load between remote clamd daemons
+# on firewall servers you may need to tune the options below.
+
+# Close the connection when the data size limit is exceeded.
+# The value should match your MTA's limit for a maximal attachment size.
+# Default: 10M
+StreamMaxLength 5M
+
+# Limit port range.
+# Default: 1024
+StreamMinPort 30000
+# Default: 2048
+StreamMaxPort 32000
+
+# Maximal number of threads running at the same time.
+# Default: 10
+MaxThreads 10
+
+# Waiting for data from a client socket will timeout after this time (seconds).
+# Value of 0 disables the timeout.
+# Default: 120
+ReadTimeout 60
+
+# Waiting for a new job will timeout after this time (seconds).
+# Default: 30
+IdleTimeout 30
+
+# Maximal depth directories are scanned at.
+# Default: 15
+MaxDirectoryRecursion 15
+
+# Follow directory symlinks.
+# Default: disabled
+FollowDirectorySymlinks
+
+# Follow regular file symlinks.
+# Default: disabled
+FollowFileSymlinks
+
+# Perform internal sanity check (database integrity and freshness).
+# Default: 1800 (30 min)
+SelfCheck 900
+
+# THIS IS KNOWN TO NOT WORK
+# Execute a command when virus is found. In the command string %v will
+# be replaced by a virus name.
+# Default: disabled
+#VirusEvent /usr/local/bin/send_sms 123456789 "VIRUS ALERT: %v"
+
+# Run as a selected user (clamd must be started by root).
+# Default: disabled
+#User clamav
+
+# Initialize supplementary group access (clamd must be started by root).
+# Default: disabled
+AllowSupplementaryGroups
+
+# Stop daemon when libclamav reports out of memory condition.
+#ExitOnOOM
+
+# Don't fork into background.
+# Default: disabled
+#Foreground
+
+# Enable debug messages in libclamav.
+# Default: disabled
+# Debug
+
+# Do not remove temporary files (for debug purposes).
+# Default: disabled
+#LeaveTemporaryFiles
+
+
+# By default clamd uses scan options recommended by libclamav. This option
+# disables recommended options and allows you to enable selected ones below.
+# DO NOT TOUCH IT unless you know what you are doing.
+# Default: disabled
+#DisableDefaultScanOptions
+
+##
+## Executable files
+##
+
+# PE stands for Portable Executable - it's an executable file format used
+# in all 32-bit versions of Windows operating systems. This option allows
+# ClamAV to perform a deeper analysis of executable files and it's also
+# required for decompression of popular executable packers such as UPX, FSG,
+# and Petite.
+# Default: enabled
+ScanPE
+
+# With this option clamav will try to detect broken executables and mark
+# them as Broken.Executable
+# Default: disabled
+#DetectBrokenExecutables
+
+
+##
+## Documents
+##
+
+# This option enables scanning of Microsoft Office document macros.
+# Default: enabled
+ScanOLE2
+
+##
+## Mail files
+##
+
+# Enable internal e-mail scanner.
+# Default: enabled
+ScanMail
+
+# If an email contains URLs ClamAV can download and scan them.
+# WARNING: This option may open your system to a DoS attack.
+#	   Never use it on loaded servers.
+# Default: disabled
+#MailFollowURLs
+
+
+##
+## HTML
+##
+
+# Perform HTML normalisation and decryption of MS Script Encoder code.
+# Default: enabled
+ScanHTML
+
+
+##
+## Archives
+##
+
+# ClamAV can scan within archives and compressed files.
+# Default: enabled
+ScanArchive
+
+# NOTE THAT CLAMAV NOW UNDERSTANDS v3.0 ARCHIVES
+# Due to license issues libclamav does not support RAR 3.0 archives (only the
+# old 2.0 format is supported). Because some users report stability problems
+# with unrarlib it's disabled by default and you must uncomment the directive
+# below to enable RAR 2.0 support.
+# Default: disabled
+ScanRAR
+
+# The options below protect your system against Denial of Service attacks
+# using archive bombs.
+
+# Files in archives larger than this limit won't be scanned.
+# Value of 0 disables the limit.
+# Default: 10M
+ArchiveMaxFileSize 5M
+
+# Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR
+# file, all files within it will also be scanned. This options specifies how
+# deep the process should be continued.
+# Value of 0 disables the limit.
+# Default: 8
+ArchiveMaxRecursion 8
+
+# Number of files to be scanned within an archive.
+# Value of 0 disables the limit.
+# Default: 1000
+ArchiveMaxFiles 500
+
+# If a file in an archive is compressed more than ArchiveMaxCompressionRatio
+# times it will be marked as a virus (Oversized.ArchiveType, e.g. Oversized.Zip)
+# Value of 0 disables the limit.
+# Default: 250
+ArchiveMaxCompressionRatio 250
+
+# Use slower but memory efficient decompression algorithm.
+# only affects the bzip2 decompressor.
+# Default: disabled
+#ArchiveLimitMemoryUsage
+
+# Mark encrypted archives as viruses (Encrypted.Zip, Encrypted.RAR).
+# Default: disabled
+#ArchiveBlockEncrypted
+
+# Mark archives as viruses (e.g. RAR.ExceededFileSize, Zip.ExceededFilesLimit)
+# if ArchiveMaxFiles, ArchiveMaxFileSize, or ArchiveMaxRecursion limit is
+# reached.
+# Default: disabled
+#ArchiveBlockMax
Index: conf/freshclam.conf
===================================================================
--- conf/freshclam.conf	(.../vendor/clamav/current)	(revision 0)
+++ conf/freshclam.conf	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,105 @@
+##
+## Example config file for freshclam
+## Please read the freshclam.conf(5) manual before editing this file.
+## This file may be optionally merged with clamd.conf.
+##
+
+
+# Comment or remove the line below.
+#Example
+
+# Path to the database directory.
+# WARNING: It must match clamd.conf's directive!
+# Default: hardcoded (depends on installation options)
+DatabaseDirectory c:\granposium\clamav\db
+
+# Path to the log file (make sure it has proper permissions)
+# Default: disabled
+UpdateLogFile c:\granposium\clamav\log\freshclam.log
+
+# Enable verbose logging.
+# Default: disabled
+# LogVerbose
+
+# Use system logger (can work together with UpdateLogFile).
+# Default: disabled
+#LogSyslog
+
+# Specify the type of syslog messages - please refer to 'man syslog'
+# for facility names.
+# Default: LOG_LOCAL6
+#LogFacility LOG_MAIL
+
+# This option allows you to save the process identifier of the daemon
+# Default: disabled
+# PidFile c:\clamav-devel\freshclam.pid
+
+# By default when started freshclam drops privileges and switches to the
+# "clamav" user. This directive allows you to change the database owner.
+# Default: clamav (may depend on installation options)
+#DatabaseOwner clamav
+
+# Initialize supplementary group access (freshclam must be started by root).
+# Default: disabled
+AllowSupplementaryGroups
+
+# Use DNS to verify virus database version. Freshclam uses DNS TXT records
+# to verify database and software versions. With this directive you can change
+# the database verification domain.
+# Default: enabled, pointing to current.cvd.clamav.net
+DNSDatabaseInfo current.cvd.clamav.net
+
+# Uncomment the following line and replace XY with your country
+# code. See http://www.iana.org/cctld/cctld-whois.htm for the full list.
+# Default: There is no default, which results in an error when running freshclam
+#DatabaseMirror db.XY.clamav.net
+
+# database.clamav.net is a round-robin record which points to our most 
+# reliable mirrors. It's used as a fall back in case db.XY.clamav.net is 
+# not working. DO NOT TOUCH the following line unless you know what you
+# are doing.
+DatabaseMirror database.clamav.net
+
+# How many attempts to make before giving up.
+# Default: 3 (per mirror)
+MaxAttempts 3
+
+# Number of database checks per day.
+# Default: 12 (every two hours)
+Checks 12
+#
+
+# Proxy settings
+# Default: disabled
+#HTTPProxyServer myproxy.com
+#HTTPProxyPort 1234
+#HTTPProxyUsername myusername
+#HTTPProxyPassword mypass
+
+# Use aaa.bbb.ccc.ddd as client address for downloading databases. Useful for
+# multi-homed systems.
+# Default: Use OS'es default outgoing IP address.
+#LocalIPAddress aaa.bbb.ccc.ddd
+
+# Send the RELOAD command to clamd.
+# Default: disabled
+NotifyClamd
+# By default it uses the hardcoded configuration file but you can force an
+# another one.
+NotifyClamd c:\granposium\clamav\conf\clamd.conf
+
+# Run command after successful database update.
+# Default: disabled
+# OnUpdateExecute c:\foo.bat
+
+# Run command when database update process fails.
+# Default: disabled
+#OnErrorExecute command
+
+# Don't fork into background.
+# Default: disabled
+#Foreground
+
+# Enable debug messages in libclamav.
+# Default: disabled
+#Debug
Index: clamav.sln
===================================================================
--- clamav.sln	(.../vendor/clamav/current)	(revision 0)
+++ clamav.sln	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,94 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libclamav", "libclamav\libclamav.vcproj", "{B2E5A0E5-B2FD-414D-A427-D54868B3120D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clamscan", "clamscan\clamscan.vcproj", "{788F16FB-BCDC-42FC-9523-E1A927A15A52}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D} = {B2E5A0E5-B2FD-414D-A427-D54868B3120D}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ex1", "examples\ex1.vcproj", "{1EB869A9-0110-4767-ABAD-FC1C544A5129}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D} = {B2E5A0E5-B2FD-414D-A427-D54868B3120D}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freshclam", "freshclam\freshclam.vcproj", "{0A20E305-3173-4AC9-9E77-CF37B3129384}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D} = {B2E5A0E5-B2FD-414D-A427-D54868B3120D}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clamdscan", "clamdscan\clamdscan.vcproj", "{ED8E81E5-94F5-4562-B403-B1EE2474B7EC}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D} = {B2E5A0E5-B2FD-414D-A427-D54868B3120D}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clamd", "clamd\clamd.vcproj", "{C08532DC-414E-4954-B395-33D60DCF06B5}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D} = {B2E5A0E5-B2FD-414D-A427-D54868B3120D}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sigtool", "sigtool\sigtool.vcproj", "{D175859E-AC75-4D90-B861-1F969CC90C63}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D} = {B2E5A0E5-B2FD-414D-A427-D54868B3120D}
+	EndProjectSection
+EndProject
+Project("{A49CE20D-CE64-4A08-9F24-92A6443D6699}") = "ClamAVSetup", "ClamAVSetup\ClamAVSetup.wixproj", "{0876E070-1A60-4267-A7CD-37F6D525E9CE}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0A20E305-3173-4AC9-9E77-CF37B3129384} = {0A20E305-3173-4AC9-9E77-CF37B3129384}
+		{36628872-DA7C-410E-BCCE-274212D29125} = {36628872-DA7C-410E-BCCE-274212D29125}
+		{D175859E-AC75-4D90-B861-1F969CC90C63} = {D175859E-AC75-4D90-B861-1F969CC90C63}
+		{1EB869A9-0110-4767-ABAD-FC1C544A5129} = {1EB869A9-0110-4767-ABAD-FC1C544A5129}
+		{C08532DC-414E-4954-B395-33D60DCF06B5} = {C08532DC-414E-4954-B395-33D60DCF06B5}
+		{ED8E81E5-94F5-4562-B403-B1EE2474B7EC} = {ED8E81E5-94F5-4562-B403-B1EE2474B7EC}
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D} = {B2E5A0E5-B2FD-414D-A427-D54868B3120D}
+		{788F16FB-BCDC-42FC-9523-E1A927A15A52} = {788F16FB-BCDC-42FC-9523-E1A927A15A52}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w32confgen", "w32confgen\w32confgen.vcproj", "{36628872-DA7C-410E-BCCE-274212D29125}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D}.Debug|Win32.Build.0 = Debug|Win32
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D}.Release|Win32.ActiveCfg = Release|Win32
+		{B2E5A0E5-B2FD-414D-A427-D54868B3120D}.Release|Win32.Build.0 = Release|Win32
+		{788F16FB-BCDC-42FC-9523-E1A927A15A52}.Debug|Win32.ActiveCfg = Debug|Win32
+		{788F16FB-BCDC-42FC-9523-E1A927A15A52}.Debug|Win32.Build.0 = Debug|Win32
+		{788F16FB-BCDC-42FC-9523-E1A927A15A52}.Release|Win32.ActiveCfg = Release|Win32
+		{788F16FB-BCDC-42FC-9523-E1A927A15A52}.Release|Win32.Build.0 = Release|Win32
+		{1EB869A9-0110-4767-ABAD-FC1C544A5129}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1EB869A9-0110-4767-ABAD-FC1C544A5129}.Debug|Win32.Build.0 = Debug|Win32
+		{1EB869A9-0110-4767-ABAD-FC1C544A5129}.Release|Win32.ActiveCfg = Release|Win32
+		{1EB869A9-0110-4767-ABAD-FC1C544A5129}.Release|Win32.Build.0 = Release|Win32
+		{0A20E305-3173-4AC9-9E77-CF37B3129384}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0A20E305-3173-4AC9-9E77-CF37B3129384}.Debug|Win32.Build.0 = Debug|Win32
+		{0A20E305-3173-4AC9-9E77-CF37B3129384}.Release|Win32.ActiveCfg = Release|Win32
+		{0A20E305-3173-4AC9-9E77-CF37B3129384}.Release|Win32.Build.0 = Release|Win32
+		{ED8E81E5-94F5-4562-B403-B1EE2474B7EC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{ED8E81E5-94F5-4562-B403-B1EE2474B7EC}.Debug|Win32.Build.0 = Debug|Win32
+		{ED8E81E5-94F5-4562-B403-B1EE2474B7EC}.Release|Win32.ActiveCfg = Release|Win32
+		{ED8E81E5-94F5-4562-B403-B1EE2474B7EC}.Release|Win32.Build.0 = Release|Win32
+		{C08532DC-414E-4954-B395-33D60DCF06B5}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C08532DC-414E-4954-B395-33D60DCF06B5}.Debug|Win32.Build.0 = Debug|Win32
+		{C08532DC-414E-4954-B395-33D60DCF06B5}.Release|Win32.ActiveCfg = Release|Win32
+		{C08532DC-414E-4954-B395-33D60DCF06B5}.Release|Win32.Build.0 = Release|Win32
+		{D175859E-AC75-4D90-B861-1F969CC90C63}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D175859E-AC75-4D90-B861-1F969CC90C63}.Debug|Win32.Build.0 = Debug|Win32
+		{D175859E-AC75-4D90-B861-1F969CC90C63}.Release|Win32.ActiveCfg = Release|Win32
+		{D175859E-AC75-4D90-B861-1F969CC90C63}.Release|Win32.Build.0 = Release|Win32
+		{0876E070-1A60-4267-A7CD-37F6D525E9CE}.Debug|Win32.ActiveCfg = Debug
+		{0876E070-1A60-4267-A7CD-37F6D525E9CE}.Release|Win32.ActiveCfg = Release
+		{0876E070-1A60-4267-A7CD-37F6D525E9CE}.Release|Win32.Build.0 = Release
+		{36628872-DA7C-410E-BCCE-274212D29125}.Debug|Win32.ActiveCfg = Debug|Win32
+		{36628872-DA7C-410E-BCCE-274212D29125}.Debug|Win32.Build.0 = Debug|Win32
+		{36628872-DA7C-410E-BCCE-274212D29125}.Release|Win32.ActiveCfg = Release|Win32
+		{36628872-DA7C-410E-BCCE-274212D29125}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Property changes on: clamav.sln
___________________________________________________________________
Name: svn:eol-style
   + CRLF

Index: freshclam/execute.c
===================================================================
--- freshclam/execute.c	(.../vendor/clamav/current)	(revision 845)
+++ freshclam/execute.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -22,18 +22,178 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 #include <errno.h>
 
+#ifdef C_WIN32
+#include <process.h>
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+
 #include "defaults.h"
 #include "freshclam.h"
 #include "output.h"
+#include "clamav.h"
 
+#if defined(C_WIN32)
+
+#define CL_MAX_CHILDREN 5
+#if CL_MAX_CHILDREN >= MAXIMUM_WAIT_OBJECTS - 1
+#error CL_MAX_CHILDREN too high for Win32
+#endif
+
 int active_children;
+HANDLE child_wait_set_modified;
+CRITICAL_SECTION child_wait_set_lock;
+int child_wait_set_lock_init;
+HANDLE child_wait_set[CL_MAX_CHILDREN];
+HANDLE child_monitor;
+volatile int child_monitor_exit;
 
+void execute_init();
+void execute_stop(void);
+
 void execute( const char *type, const char *text )
 {
+	char *argv[4], *text_copy;
+	HANDLE process_handle;
+
+	if (child_wait_set_lock_init == 0)
+		execute_init();
+	if (child_wait_set_lock_init == 0) {
+		mprintf("@%s: couldn't init execute module\n", type);
+		return;
+	}
+
+	EnterCriticalSection(&child_wait_set_lock);
+	if ( active_children >= CL_MAX_CHILDREN ) {
+		mprintf("@%s: already %d processes active.\n", type, active_children);
+		LeaveCriticalSection(&child_wait_set_lock);
+		return;
+	}
+
+	text_copy = strdup(text);
+	if (text_copy == NULL) {
+		mprintf("@%s: out of memory\n", type);
+		EnterCriticalSection(&child_wait_set_lock);
+		return;
+	}
+
+	/* spawn cmd /c */
+	argv[0] = cl_getenv("COMSPEC");
+	argv[1] = "/c";
+	argv[2] = text_copy;
+	argv[3] = NULL;
+
+	if (argv[0] == NULL) {
+		argv[0] = "cmd.exe";
+		process_handle = (HANDLE)_spawnvp(_P_NOWAIT, argv[0], argv);
+	} else
+		process_handle = (HANDLE)_spawnv(_P_NOWAIT, argv[0], argv);
+	free(text_copy);
+
+	if (process_handle == (HANDLE)-1 || process_handle == (HANDLE)0) {
+		mprintf("@%s: couldn't execute \"%s\": %s\n", type, text, strerror(errno));
+		LeaveCriticalSection(&child_wait_set_lock);
+		return;
+	}
+
+	/* add to the set of handles waited on by the spare thread */
+	child_wait_set[active_children++] = process_handle;
+	SetEvent(child_wait_set_modified);
+	LeaveCriticalSection(&child_wait_set_lock);
+}
+
+unsigned int __stdcall execute_monitor(void *arg)
+{
+	arg;
+	while (!child_monitor_exit) {
+		HANDLE wait_objects[CL_MAX_CHILDREN + 1];
+		int i;
+		DWORD reason;
+
+		wait_objects[0] = child_wait_set_modified;
+		EnterCriticalSection(&child_wait_set_lock);
+		for (i = 1; i <= active_children; ++i) {
+			wait_objects[i] = child_wait_set[i - 1];
+		}
+		LeaveCriticalSection(&child_wait_set_lock);
+
+		switch (reason = WaitForMultipleObjects(i, wait_objects, FALSE, INFINITE))
+		{
+		case WAIT_OBJECT_0:
+			break;
+		default:
+			if (!(reason >= WAIT_OBJECT_0 + 1 && reason <= WAIT_OBJECT_0 + active_children)) {
+				mprintf("@execute_monitor: WaitForMultipleObjects failed, reason = %lu, last error = %lu\n", 
+					reason, GetLastError());
+				break;
+			}
+			i = (int)(reason - WAIT_OBJECT_0 - 1);
+
+			EnterCriticalSection(&child_wait_set_lock);
+			CloseHandle(child_wait_set[i]);
+			for ( ; i < active_children - 1; ++i)
+				child_wait_set[i] = child_wait_set[i + 1];
+			--active_children;
+			LeaveCriticalSection(&child_wait_set_lock);
+			break;
+		}
+	}
+	return 0;
+}
+
+void execute_init()
+{
+	unsigned tid;
+	child_monitor_exit = 0;
+
+	InitializeCriticalSection(&child_wait_set_lock);
+	child_wait_set_lock_init = 1;
+
+	child_wait_set_modified = CreateEvent(NULL, FALSE, FALSE, NULL);
+	if (child_wait_set_modified == NULL) {
+		mprintf("@couldn't create wait event with %lu, execute() will not be available\n", GetLastError());
+		active_children = CL_MAX_CHILDREN;
+		return;
+	}
+
+	child_monitor = (HANDLE)_beginthreadex(NULL, 0, execute_monitor, NULL, 0, &tid);
+	if (child_monitor == NULL) {
+		mprintf("@couldn't spawn child monitor thread with %lu, execute() will not be available\n", GetLastError());
+		active_children  = CL_MAX_CHILDREN;
+		return;
+	}
+	atexit(execute_stop);
+}
+
+void execute_stop(void)
+{
+	if (child_monitor) {
+		/* quit monitor thread */
+		child_monitor_exit = 1;
+		SetEvent(child_wait_set_modified);
+		(void) WaitForSingleObject(child_monitor, INFINITE);
+
+		CloseHandle(child_monitor);
+	}
+	if (child_wait_set_modified) {
+		CloseHandle(child_wait_set_modified);
+		child_wait_set_modified = NULL;
+	}
+	if (child_wait_set_lock_init) {
+		DeleteCriticalSection(&child_wait_set_lock);
+		child_wait_set_lock_init = 0;
+	}
+}
+
+#else
+int active_children;
+
+void execute( const char *type, const char *text )
+{
 	pid_t pid;
 
 	if ( active_children<CL_MAX_CHILDREN )
@@ -55,3 +215,4 @@
 		mprintf("@%s: already %d processes active.\n", type, active_children);
 	}
 }
+#endif
Index: freshclam/freshclam.c
===================================================================
--- freshclam/freshclam.c	(.../vendor/clamav/current)	(revision 845)
+++ freshclam/freshclam.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,17 +23,28 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <signal.h>
 #include <time.h>
 #include <sys/types.h>
-#include <sys/wait.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#include <direct.h>
+#include <process.h>
+#include <windows.h>
+#include "w32_service.h"
+extern w32_service g_service;
+void sleep(int sec) { Sleep(sec * 1000); }
+#else
+#include <unistd.h>
 #include <pwd.h>
 #include <grp.h>
+#include <sys/wait.h>
+#endif
 
 #if defined(USE_SYSLOG) && !defined(C_AIX)
 #include <syslog.h>
@@ -48,9 +59,23 @@
 #include "misc.h"
 #include "execute.h"
 
-static short terminate = 0;
+
+short terminate = 0;
 extern int active_children;
 
+#if defined(C_WIN32)
+BOOL WINAPI CtrlHandler(DWORD dwCtrlType)
+{
+	switch (dwCtrlType) 
+	{
+	case CTRL_C_EVENT:
+	case CTRL_BREAK_EVENT:
+		terminate = 1;
+		return TRUE;
+	}
+	return FALSE;
+}
+#else
 static void daemon_sighandler(int sig) {
 
     switch(sig) {
@@ -75,8 +100,8 @@
 
     return;
 }
+#endif
 
-
 static void writepid(char *pidfile) {
 	FILE *fd;
 	int old_umask;
@@ -94,12 +119,14 @@
 int freshclam(struct optstruct *opt)
 {
 	int ret = 52;
-	char *newdir, *cfgfile;
+	const char *newdir, *cfgfile;
 	char *pidfile = NULL;
 	struct cfgstruct *copt, *cpt;
+#if !defined(C_WIN32)
 	struct sigaction sigact;
 	struct sigaction oldact;
-#if !defined(C_CYGWIN)  && !defined(C_OS2)
+#endif
+#if !defined(C_CYGWIN)  && !defined(C_OS2) && !defined(C_WIN32)
 	char *unpuser;
 	struct passwd *user;
 #endif
@@ -109,21 +136,37 @@
 	free_opt(opt);
     	help();
     }
+	if (optl(opt, "install")) {
+		w32_service_install(&g_service);
+		exit(1);
+	}
+	if (optl(opt, "uninstall")) {
+		w32_service_uninstall(&g_service);
+		exit(1);
+	}
 
     /* parse the config file */
     if((cfgfile = getargl(opt, "config-file"))) {
 	copt = parsecfg(cfgfile, 1);
     } else {
-	/* TODO: force strict permissions on freshclam.conf */
-	if((copt = parsecfg((cfgfile = CONFDIR"/freshclam.conf"), 1)) == NULL)
-	    copt = parsecfg((cfgfile = CONFDIR"/clamd.conf"), 1);
+		char *confPath;
+		confPath = cl_retconfpath("freshclam.conf");
+		if (confPath) {
+			/* TODO: force strict permissions on freshclam.conf */
+			if((copt = parsecfg((cfgfile = confPath), 1)) == NULL) {
+				free(confPath);
+				confPath = cl_retconfpath("clamd.conf");
+				if (confPath)
+					copt = parsecfg((cfgfile = confPath), 1);
+			}
+			free(confPath);
+		}
+		if(!copt) {
+			mprintf("!Can't parse the config file %s\n", cfgfile);
+			return 56;
+		}
     }
 
-    if(!copt) {
-	mprintf("!Can't parse the config file %s\n", cfgfile);
-	return 56;
-    }
-
     if(optl(opt, "http-proxy") || optl(opt, "proxy-user"))
 	mprintf("WARNING: Proxy settings are now only configurable in the config file.\n");
 
@@ -132,7 +175,7 @@
 	    mprintf("@Can't stat %s (critical error)\n", cfgfile);
 	    return 56;
 	}
-#ifndef C_CYGWIN
+#if !defined(C_CYGWIN) && !defined(C_WIN32)
 	if(statbuf.st_mode & (S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)) {
 	    mprintf("@Insecure permissions (for HTTPProxyPassword): %s must have no more than 0700 permissions.\n", cfgfile);
 	    return 56;
@@ -140,7 +183,7 @@
 #endif
     }
 
-#if !defined(C_CYGWIN)  && !defined(C_OS2)
+#if !defined(C_CYGWIN)  && !defined(C_OS2) && !defined(C_WIN32)
     /* freshclam shouldn't work with root privileges */
     if(optc(opt, 'u')) {
 	unpuser = getargc(opt, 'u');
@@ -261,8 +304,10 @@
 	    int bigsleep, checks;
 	    time_t now, wakeup;
 
+#if !defined(C_WIN32)
 	memset(&sigact, 0, sizeof(struct sigaction));
 	sigact.sa_handler = daemon_sighandler;
+#endif
 
 	if(optc(opt, 'c')) {
 	    checks = atoi(getargc(opt, 'c'));
@@ -302,10 +347,14 @@
 
 	logg("freshclam daemon "VERSION" (OS: "TARGET_OS_TYPE", ARCH: "TARGET_ARCH_TYPE", CPU: "TARGET_CPU_TYPE")\n");
 
+#if defined(C_WIN32)
+	SetConsoleCtrlHandler(CtrlHandler, TRUE);
+#else
 	sigaction(SIGTERM, &sigact, NULL);
 	sigaction(SIGHUP, &sigact, NULL);
 	sigaction(SIGINT, &sigact, NULL);
-        sigaction(SIGCHLD, &sigact, NULL);
+	sigaction(SIGCHLD, &sigact, NULL);
+#endif
 
 	while(!terminate) {
 	    ret = download(copt, opt);
@@ -323,13 +372,21 @@
 	    }
 
 	    logg("--------------------------------------\n");
+#if !defined(C_WIN32)
 	    sigaction(SIGALRM, &sigact, &oldact);
 	    sigaction(SIGUSR1, &sigact, &oldact);
+#endif
 	    time(&wakeup);
 	    wakeup += bigsleep;
+#if !defined(C_WIN32)
 	    alarm(bigsleep);
+#endif
 	    do {
+#if !defined(C_WIN32)
 		pause();
+#else
+		sleep(1);
+#endif
 		time(&now);
 	    } while (!terminate && now < wakeup);
 
@@ -341,9 +398,10 @@
 		terminate = 0;
 		logg_close();
 	    }
-
+#if !defined(C_WIN32)
 	    sigaction(SIGALRM, &oldact, NULL);
 	    sigaction(SIGUSR1, &oldact, NULL);
+#endif
 	}
 
     } else
@@ -385,7 +443,9 @@
 
 	while(cpt) {
 	    ret = downloadmanager(copt, opt, cpt->strarg);
+#if !defined(C_WIN32)
 	    alarm(0);
+#endif
 
 	    if(ret == 52 || ret == 54 || ret == 58 || ret == 59) {
 		if(try < maxattempts - 1) {
@@ -416,6 +476,11 @@
 
 void daemonize(void)
 {
+#ifdef C_WIN32
+    mprintf_disabled = 1;
+	g_service.update_scm(&g_service, SERVICE_RUNNING, 0, 1000);
+	return;
+#else
 	int i;
 
     for(i = 0; i < 3; i++)
@@ -428,6 +493,7 @@
 
     setsid();
     mprintf_disabled = 1;
+#endif
 }
 
 void help(void)
@@ -460,6 +526,11 @@
     mprintf("    --on-update-execute=COMMAND          execute COMMAND after successful update\n");
     mprintf("    --on-error-execute=COMMAND           execute COMMAND if errors occured\n");
     mprintf("    --on-outdated-execute=COMMAND        execute COMMAND when software is outdated\n");
+#ifdef C_WIN32
+	mprintf("    --install                            install windows service.\n");
+	mprintf("    --uninstall                          uninstall windows service.\n");
+#endif
+
     mprintf("\n");
     exit(0);
 }
Index: freshclam/notify.c
===================================================================
--- freshclam/notify.c	(.../vendor/clamav/current)	(revision 845)
+++ freshclam/notify.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,14 +23,21 @@
 #ifdef BUILD_CLAMD
 
 #include <stdio.h>
+#include <sys/types.h>
+#include <string.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#include <windows.h>
+#else
 #include <unistd.h>
-#include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-#include <string.h>
+#define closesocket close
+#endif
 
 #include "others.h"
 #include "cfgparser.h"
@@ -39,7 +46,9 @@
 int notify(const char *cfgfile)
 {
 	char buff[20];
+#ifndef C_WIN32
 	struct sockaddr_un server;
+#endif
         struct sockaddr_in server2;
 	struct hostent *he;
 	struct cfgstruct *copt, *cpt;
@@ -55,7 +64,9 @@
     if(cfgopt(copt, "TCPSocket") && cfgopt(copt, "LocalSocket")) {
 	mprintf("@Clamd was NOT notified: Both socket types (TCP and local) declared in %s\n", cfgfile);
 	return 1;
-    } else if((cpt = cfgopt(copt, "LocalSocket"))) {
+    } 
+#ifndef C_WIN32
+	else if((cpt = cfgopt(copt, "LocalSocket"))) {
 	socktype = "UNIX";
 	server.sun_family = AF_UNIX;
 	strncpy(server.sun_path, cpt->strarg, sizeof(server.sun_path));
@@ -67,19 +78,20 @@
 	}
 
 	if(connect(sockd, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) {
-	    close(sockd);
+	    closesocket(sockd);
 	    mprintf("@Clamd was NOT notified: Can't connect to clamd through %s\n", cpt->strarg);
 	    perror("connect()");
 	    return 1;
 	}
+    }
+#endif
+	else if((cpt = cfgopt(copt, "TCPSocket"))) {
 
-    } else if((cpt = cfgopt(copt, "TCPSocket"))) {
-
 	socktype = "TCP";
 #ifdef PF_INET
-	if((sockd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
+	if((sockd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
 #else
-	if((sockd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+	if((sockd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
 #endif
 	    mprintf("@Clamd was NOT notified: Can't create TCP socket\n");
 	    perror("socket()");
@@ -101,7 +113,7 @@
 
 
 	if(connect(sockd, (struct sockaddr *) &server2, sizeof(struct sockaddr_in)) < 0) {
-	    close(sockd);
+	    closesocket(sockd);
 	    mprintf("@Clamd was NOT notified: Can't connect to clamd on %s:%d\n",
 		    inet_ntoa(server2.sin_addr), ntohs(server2.sin_port));
 	    perror("connect()");
@@ -113,23 +125,23 @@
 	return 1;
     }
 
-    if(write(sockd, "RELOAD", 6) < 0) {
+    if(send(sockd, "RELOAD", 6, 0) < 0) {
 	mprintf("@Clamd was NOT notified: Could not write to %s socket\n", socktype);
 	perror("write()");
-	close(sockd);
+	closesocket(sockd);
 	return 1;
     }
 
     /* TODO: Handle timeout */
     memset(buff, 0, sizeof(buff));
-    if((bread = read(sockd, buff, sizeof(buff))) > 0)
+    if((bread = recv(sockd, buff, sizeof(buff) - 1, 0)) > 0)
 	if(!strstr(buff, "RELOADING")) {
 	    mprintf("@Clamd was NOT notified: Unknown answer from clamd: '%s'\n", buff);
-	    close(sockd);
+	    closesocket(sockd);
 	    return 1;
 	}
 
-    close(sockd);
+    closesocket(sockd);
     mprintf("Clamd successfully notified about the update.\n");
     logg("Clamd successfully notified about the update.\n");
     return 0;
Index: freshclam/manager.c
===================================================================
--- freshclam/manager.c	(.../vendor/clamav/current)	(revision 845)
+++ freshclam/manager.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -26,20 +26,27 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 #include <ctype.h>
-#include <netinet/in.h>
-#include <netdb.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
 #include <time.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <clamav.h>
 #include <errno.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#include <direct.h>
+#include <windows.h>
+#else
+#include <netdb.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#endif
+
 #include "options.h"
 #include "defaults.h"
 #include "manager.h"
@@ -50,7 +57,12 @@
 #include "../libclamav/others.h"
 #include "../libclamav/str.h" /* cli_strtok */
 #include "dns.h"
+#include "execute.h"
 
+#ifndef C_WIN32
+/* win32 sockets are not fds, sadly */
+#define closesocket	close
+#endif
 
 int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, const char *hostname)
 {
@@ -60,7 +72,7 @@
 	char ipaddr[16], *dnsreply = NULL, *pt, *localip = NULL, *newver = NULL;
 	struct cfgstruct *cpt;
 	const char *arg = NULL;
-#ifdef HAVE_RESOLV_H
+#if defined(HAVE_RESOLV_H) || defined(C_WIN32)
 	const char *dnsdbinfo;
 #endif
 
@@ -75,7 +87,7 @@
     logg("See the FAQ at http://www.clamav.net/faq.html for an explanation.\n");
 #endif
 
-#ifdef HAVE_RESOLV_H
+#if defined(HAVE_RESOLV_H) || defined(C_WIN32)
     if((cpt = cfgopt(copt, "DNSDatabaseInfo")))
 	dnsdbinfo = cpt->strarg;
     else
@@ -196,16 +208,31 @@
 #ifdef BUILD_CLAMD
 	if(optl(opt, "daemon-notify")) {
 		const char *clamav_conf = getargl(opt, "daemon-notify");
-	    if(!clamav_conf)
-		clamav_conf = CONFDIR"/clamd.conf";
 
-	    notify(clamav_conf);
+		if (!clamav_conf) {
+			char *clamav_conf_t = cl_retconfpath("clamd.conf");
+			if (!clamav_conf_t) {
+				mprintf("@Clamd was not notified: out of memory\n");
+			} else {
+				notify(clamav_conf_t);
+				free(clamav_conf_t);
+			}
+		} else {
+			notify(clamav_conf);
+		}
 	} else if((cpt = cfgopt(copt, "NotifyClamd"))) {
 		const char *clamav_conf = cpt->strarg;
-	    if(!clamav_conf)
-		clamav_conf = CONFDIR"/clamd.conf";
-
-	    notify(clamav_conf);
+		if (!clamav_conf) {
+			char *clamav_conf_t = cl_retconfpath("clamd.conf");
+			if (!clamav_conf_t) {
+				mprintf("@Clamd was not notified: out of memory\n");
+			} else {
+				notify(clamav_conf_t);
+				free(clamav_conf_t);
+			}
+		} else {
+			notify(clamav_conf);
+		}
 	}
 #endif
 
@@ -262,7 +289,7 @@
 {
 	struct cl_cvd *current, *remote;
 	struct cfgstruct *cpt;
-	int hostfd, nodb = 0, dbver = -1, ret, port = 0, ims = -1;
+	int hostfd = -1, nodb = 0, dbver = -1, ret, port = 0, ims = -1;
 	char  *tempname, ipaddr[16], *pt;
 	const char *proxy = NULL, *user = NULL, *pass = NULL;
 	int flevel = cl_retflevel();
@@ -331,7 +358,7 @@
 	else
 	    hostfd = wwwconnect(hostname, proxy, port, ipaddr, localip);
 
-	if(hostfd < 0) {
+	if(hostfd == -1) {
             mprintf("@No servers could be reached. Giving up\n");
 	    if(current)
 		cl_cvdfree(current);
@@ -350,14 +377,16 @@
 	    mprintf("%s is up to date (version: %d, sigs: %d, f-level: %d, builder: %s)\n", localname, current->version, current->sigs, current->fl, current->builder);
 	    logg("%s is up to date (version: %d, sigs: %d, f-level: %d, builder: %s)\n", localname, current->version, current->sigs, current->fl, current->builder);
 	    *signo += current->sigs;
-	    close(hostfd);
+		if (hostfd != -1)
+			closesocket(hostfd);
 	    cl_cvdfree(current);
 	    return 1;
 	}
 
 	if(!remote) {
 	    mprintf("@Can't read %s header from %s (IP: %s)\n", remotename, hostname, ipaddr);
-	    close(hostfd);
+		if (hostfd != -1)
+			closesocket(hostfd);
 	    if(current)
 		cl_cvdfree(current);
 	    return 58;
@@ -365,7 +394,8 @@
 
 	dbver = remote->version;
 	cl_cvdfree(remote);
-	close(hostfd);
+	if (hostfd != -1)
+		closesocket(hostfd);
     }
 
     if(!nodb && (current->version >= dbver)) {
@@ -399,7 +429,7 @@
 	    strcpy(ip, ipaddr);
     }
 
-    if(hostfd < 0) {
+    if(hostfd == -1) {
 	if(ipaddr[0])
 	    mprintf("Connection with %s (IP: %s) failed.\n", hostname, ipaddr);
 	else
@@ -417,11 +447,11 @@
         mprintf("@Can't download %s from %s (IP: %s)\n", remotename, hostname, ipaddr);
         unlink(tempname);
         free(tempname);
-        close(hostfd);
+        closesocket(hostfd);
         return ret;
     }
 
-    close(hostfd);
+    closesocket(hostfd);
 
     if((ret = cl_cvdverify(tempname))) {
         mprintf("@Verification: %s\n", cl_strerror(ret));
@@ -553,7 +583,7 @@
 	hostpt = proxy;
 
 	if(!(port = pport)) {
-#ifndef C_CYGWIN
+#if !defined(C_CYGWIN) && !defined(C_WIN32)
 		const struct servent *webcache = getservbyname("webcache", "TCP");
 
 		if(webcache)
@@ -596,7 +626,7 @@
 		break;
 	}
         mprintf("@Can't get information about %s: %s\n", hostpt, herr);
-	close(socketfd);
+	closesocket(socketfd);
 	return -1;
     }
 
@@ -622,7 +652,7 @@
 	}
     }
 
-    close(socketfd);
+    closesocket(socketfd);
     return -2;
 }
 
@@ -673,6 +703,7 @@
     mprintf("*If-Modified-Since: %s\n", last_modified);
 
     mprintf("Reading CVD header (%s): ", file);
+
 #ifdef	NO_SNPRINTF
     sprintf(cmd, "GET %s/%s HTTP/1.1\r\n"
 	"Host: %s\r\n%s"
@@ -690,18 +721,20 @@
         "If-Modified-Since: %s\r\n"
         "\r\n", (remotename != NULL)?remotename:"", file, hostname, (authorization != NULL)?authorization:"", last_modified);
 #endif
-    write(socketfd, cmd, strlen(cmd));
+    send(socketfd, cmd, strlen(cmd), 0);
 
     free(remotename);
     free(authorization);
 
     tmp = buffer;
-    cnt = FILEBUFF;
+    cnt = FILEBUFF - 1;
     while ((bread = recv(socketfd, tmp, cnt, 0)) > 0) {
 	tmp+=bread;
 	cnt-=bread;
 	if (cnt <= 0) break;
     }
+	*tmp = '\0';
+	/* mprintf("%.*s\n",512,buffer); */
 
     if(bread == -1) {
 	mprintf("@Error while reading CVD header of database from %s\n", hostname);
@@ -779,7 +812,9 @@
         }
     }
 
-#if defined(C_CYGWIN) || defined(C_OS2)
+#if defined(C_WIN32)
+    if((fd = open(file, O_WRONLY|O_CREAT|O_EXCL|O_BINARY, S_IREAD|S_IWRITE)) == -1) {
+#elif defined(C_CYGWIN) || defined(C_OS2)
     if((fd = open(file, O_WRONLY|O_CREAT|O_EXCL|O_BINARY, 0644)) == -1) {
 #else
     if((fd = open(file, O_WRONLY|O_CREAT|O_EXCL, 0644)) == -1) {
@@ -788,7 +823,9 @@
 
 	getcwd(currdir, sizeof(currdir));
 	mprintf("@Can't create new file %s in %s\n", file, currdir);
+#if !defined(C_WIN32)
 	mprintf("@The database directory must be writable for UID %d or GID %d\n", getuid(), getgid());
+#endif
 	return 57;
     }
 
@@ -807,7 +844,7 @@
 	     "Connection: close\r\n"
 	     "\r\n", (remotename != NULL)?remotename:"", dbfile, hostname, (authorization != NULL)?authorization:"");
 #endif
-    write(socketfd, cmd, strlen(cmd));
+    send(socketfd, cmd, strlen(cmd), 0);
 
     free(remotename);
     free(authorization);
@@ -847,7 +884,7 @@
 
     /* receive body and write it to disk */
 
-    while((bread = read(socketfd, buffer, FILEBUFF))) {
+    while((bread = recv(socketfd, buffer, FILEBUFF, 0))) {
 	write(fd, buffer, bread);
 	mprintf("Downloading %s [%c]\r", dbfile, rotation[rot]);
 	fflush(stdout);
Index: freshclam/defaults.h
===================================================================
--- freshclam/defaults.h	(.../vendor/clamav/current)	(revision 845)
+++ freshclam/defaults.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -20,7 +20,7 @@
 # define DATADIR "/usr/local/share/clamav"
 #endif
 
-#define VIRUSDBDIR DATADIR
+#define VIRUSDBDIR cl_retdbdir()
 
 /* default names */
 
Index: freshclam/dns.c
===================================================================
--- freshclam/dns.c	(.../vendor/clamav/current)	(revision 845)
+++ freshclam/dns.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -108,6 +108,39 @@
     return txt;
 }
 
+#elif defined(C_WIN32)
+
+#include <windows.h>
+#include <windns.h>
+#include "output.h"
+
+char *txtquery(const char *domain, unsigned int *ttl)
+{
+	DNS_RECORD *results = NULL;
+	DNS_STATUS status;
+	char *ret;
+
+	status = DnsQuery_A(domain, DNS_TYPE_TEXT, DNS_QUERY_STANDARD, NULL, &results, NULL);
+	if (FAILED(status)) {
+		mprintf("@DnsQuery_A failed with %ld\n", status);
+		return NULL;
+	}
+	if (!results || results[0].Data.Txt.dwStringCount == 0 || results[0].Data.Txt.pStringArray[0] == NULL) {
+		mprintf("@No result from DnsQuery_A\n");
+		DnsRecordListFree(results, DnsFreeRecordList);
+		return NULL;
+	}
+	if (results[0].wType != DNS_TYPE_TEXT) {
+		mprintf("@Not a TXT record\n");
+		DnsRecordListFree(results, DnsFreeRecordList);
+		return NULL;
+	}
+	*ttl = results[0].dwTtl;
+	ret = strdup(results[0].Data.Txt.pStringArray[0]);
+	DnsRecordListFree(results, DnsFreeRecordList);
+	return ret;
+}
+
 #else
 
 char *txtquery(const char *domain, unsigned int *ttl)
Index: freshclam/freshclam.vcproj
===================================================================
--- freshclam/freshclam.vcproj	(.../vendor/clamav/current)	(revision 0)
+++ freshclam/freshclam.vcproj	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,309 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="freshclam"
+	ProjectGUID="{0A20E305-3173-4AC9-9E77-CF37B3129384}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".,..,..\libclamav,..\shared"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib pthreadVC2.lib DnsAPI.lib"
+				OutputFile="$(OutDir)\$(ProjectName)D.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName)D.pdb"
+				SubSystem="1"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".,..,..\libclamav,..\shared"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib pthreadVC2.lib DnsAPI.lib"
+				OutputFile="$(OutDir)\$(ProjectName).exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\dns.c"
+				>
+			</File>
+			<File
+				RelativePath=".\execute.c"
+				>
+			</File>
+			<File
+				RelativePath=".\freshclam.c"
+				>
+			</File>
+			<File
+				RelativePath=".\manager.c"
+				>
+			</File>
+			<File
+				RelativePath=".\notify.c"
+				>
+			</File>
+			<File
+				RelativePath=".\options.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\defaults.h"
+				>
+			</File>
+			<File
+				RelativePath=".\dns.h"
+				>
+			</File>
+			<File
+				RelativePath=".\execute.h"
+				>
+			</File>
+			<File
+				RelativePath=".\freshclam.h"
+				>
+			</File>
+			<File
+				RelativePath=".\manager.h"
+				>
+			</File>
+			<File
+				RelativePath=".\notify.h"
+				>
+			</File>
+			<File
+				RelativePath=".\options.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="shared"
+			>
+			<File
+				RelativePath="..\shared\cfgparser.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\cfgparser.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\getopt.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\memory.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\memory.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\misc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\misc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\output.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\output.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\w32_service.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\w32_service.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes on: freshclam/freshclam.vcproj
___________________________________________________________________
Name: svn:eol-style
   + CRLF

Index: freshclam/options.c
===================================================================
--- freshclam/options.c	(.../vendor/clamav/current)	(revision 845)
+++ freshclam/options.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -16,6 +16,10 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -23,6 +27,16 @@
 #define _GNU_SOURCE
 #include "getopt.h"
 
+#ifdef C_WIN32
+#include <tchar.h>
+#include <windows.h>
+#include "w32_service.h"
+#endif
+
+#if defined(_MSC_VER) && defined(_DEBUG) && defined(C_WIN32)
+#include <crtdbg.h>
+#endif
+
 #include "options.h"
 #include "output.h"
 #include "memory.h"
@@ -33,7 +47,11 @@
 static void register_long_opt(struct optstruct *opt, const char *optname, struct option* longopts);
 
 
+#ifdef C_WIN32
+int normal_main(int argc, char **argv)
+#else
 int main(int argc, char **argv)
+#endif
 {
 	int ret, opt_index, i, len;
 	struct optstruct *opt;
@@ -67,10 +85,24 @@
 	    {"on-update-execute", 1, 0, 0},
 	    {"on-error-execute", 1, 0, 0},
 	    {"on-outdated-execute", 1, 0, 0},
+#ifdef C_WIN32
+		{"install", 0, 0, 0},
+		{"uninstall", 0, 0, 0},
+#endif
 	    {0, 0, 0, 0}
     	};
 
+#if defined(C_WIN32)
+	WSADATA wsa;
 
+	ZeroMemory(&wsa, sizeof(wsa));
+	ret = WSAStartup(MAKEWORD(1, 1), &wsa);
+	if (ret != 0) {
+		mprintf("WSAStartup failed with %d\n", ret);
+		return 56;
+	}
+#endif
+
     opt=(struct optstruct*)mcalloc(1, sizeof(struct optstruct));
     opt->optlist = NULL;
 
@@ -125,6 +157,67 @@
     return ret;
 }
 
+#ifdef C_WIN32
+
+extern short terminate;
+w32_service g_service;
+
+static int w32_service_main(w32_service *s, DWORD argc, LPTSTR *argv)
+{
+	DWORD i;
+	char **argv2;
+
+#if defined(_MSC_VER) && defined(_DEBUG)
+	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
+/*	_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
+	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+	_CrtSetBreakAlloc(127847);
+	*/
+#endif
+	/* Need to force a -d in for freshclam */
+	argv2 = (char **)malloc(sizeof(char *) * (argc + 2));
+	if (!argv2) {
+		return ERROR_OUTOFMEMORY;
+	}
+	for (i = 0; i < argc; ++i) {
+		argv2[i] = argv[i];
+	}
+	argv2[argc++] = "-d";
+	(void)normal_main(argc, argv2);
+	free(argv2);
+	return 0;
+}
+
+static void w32_service_stop(w32_service *s)
+{
+	s->update_scm(s, SERVICE_STOP_PENDING, 0, 60000);
+	terminate = 1;
+}
+
+int main(int argc, char **argv)
+{
+	int i;
+
+	if (!w32_service_create(&g_service)) {
+		fprintf(stderr, "Failed to create a win32 service object\n");
+		return 56;
+	}
+	g_service.name = _T("freshclam");
+	g_service.display_name = _T("Clam AntiVirus Update Service");
+	g_service.description = _T("Automatically keeps the virus scanning database up to date, downloading new versions as they become available.");
+	g_service.main = w32_service_main;
+	g_service.stop = w32_service_stop;
+
+	for (i = 1; i < argc; ++i) {
+		if (strcasecmp(argv[i], "--service") == 0) {
+			w32_services_start();
+			return 0;
+		}
+	}
+	return normal_main((int)argc, argv);
+}
+#endif
+
 static struct option* find_char_opt(char optchar, struct option* longopts)
 {
 	int i;
Index: shared/output.c
===================================================================
--- shared/output.c	(.../vendor/clamav/current)	(revision 845)
+++ shared/output.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -29,17 +29,23 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <time.h>
 #include <sys/stat.h>
 #include <errno.h>
-#include <sys/time.h>
-#include <sys/socket.h>
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
 
+#ifdef C_WIN32
+#include <io.h>
+#include <windows.h>
+#else
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <unistd.h>
+#endif
+
 #if defined(USE_SYSLOG) && !defined(C_AIX)
 #include <syslog.h>
 #endif
@@ -106,7 +112,6 @@
 int logg(const char *str, ...)
 {
 	va_list args, argscpy;
-	struct flock fl;
 	char *pt, *timestr, vbuff[1025];
 	time_t currtime;
 	struct stat sb;
@@ -123,7 +128,8 @@
 #endif
 	if(!logg_fs) {
 	    old_umask = umask(0037);
-	    if((logg_fs = fopen(logg_file, "a")) == NULL) {
+
+	    if((logg_fs = fopen(logg_file, "at")) == NULL) {
 		umask(old_umask);
 #ifdef CL_THREAD_SAFE
 		pthread_mutex_unlock(&logg_mutex);
@@ -132,7 +138,9 @@
 		return -1;
 	    } else umask(old_umask);
 
+#ifndef C_WIN32
 	    if(logg_lock) {
+		struct flock fl;
 		memset(&fl, 0, sizeof(fl));
 		fl.l_type = F_WRLCK;
 		if(fcntl(fileno(logg_fs), F_SETLK, &fl) == -1) {
@@ -142,6 +150,7 @@
 		    return -1;
 		}
 	    }
+#endif
 	}
 
         /* Need to avoid logging time for verbose messages when logverbose
Index: shared/w32_service.h
===================================================================
--- shared/w32_service.h	(.../vendor/clamav/current)	(revision 0)
+++ shared/w32_service.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,99 @@
+/*
+ *  Copyright (C) 2005 Mark Weaver <mark@npsl.co.uk>
+ *
+ *  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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __W32_SERVICE_H
+#define __W32_SERVICE_H
+
+/** 
+ * A "this" thunk
+ */
+#pragma pack(push)
+#pragma pack(1)
+typedef struct w32_service_thunk_s
+{
+	DWORD pushesp;	/* push dword ptr [esp] */
+	BYTE movsp4[3];	/* mov dword ptr [esp+4], arg */
+	DWORD arg;
+	BYTE jmp;		/* jmp (rel) function */
+	DWORD func;
+} w32_service_thunk;
+#pragma pack(pop)
+
+/**
+ * Win32 service wrapper (adapted from OW32)
+ */
+typedef struct w32_service_s
+{
+	/* Next service, for shared services */
+	struct w32_service_s *next;
+
+	/* Thunks to allow shared_process services to work */
+	w32_service_thunk *main_thunk;
+	w32_service_thunk *handler_thunk;
+
+	/* Service information */
+	/* At a minimum you need to set the name & display_name */
+	LPCTSTR name;
+	LPCTSTR display_name;
+	LPCTSTR description;
+	DWORD desired_access;
+	DWORD service_type;
+	DWORD start_type;
+	DWORD error_control;
+	LPCTSTR binary_path_name;
+	LPCTSTR load_order_group;
+	LPCTSTR dependencies;
+	LPCTSTR start_name;
+	LPCTSTR password;
+
+	/* Main function for service (can be overridden if desired) */
+	DWORD (*main)(struct w32_service_s *s, DWORD argc, LPTSTR *argv);
+
+	/* Service status handle, in case you want to do something */
+	/* special the UpdateSCM doesn't cover. */
+	SERVICE_STATUS_HANDLE service_status;
+
+	/* Helper to update the SCM */
+	void (*update_scm)(struct w32_service_s *s, DWORD state, DWORD check_point, DWORD wait_hint);
+
+	/* The service handler, override for custom control notifications */
+	/* Call the base handler (w32_service_handler) to dispatch to stop, pause, etc.. */
+	void (*handler)(struct w32_service_s *s, DWORD fdwControl);
+
+	/* Called when the stop signal is received */
+	void (*stop)(struct w32_service_s *s);
+	/* Called on pause */
+	void (*pause)(struct w32_service_s *s);
+	/* Called on continue */
+	void (*continue_)(struct w32_service_s *s);
+	/* Called on system shutdown */
+	void (*shutdown)(struct w32_service_s *s);
+	/* Called on interrogate, defaults to "running" */
+	void (*interrogate)(struct w32_service_s *s);
+} w32_service;
+
+/** Create a service with default options */
+int w32_service_create(w32_service *s);
+/** Install a service */
+void w32_service_install(w32_service *s);
+/** Uninstall a service */
+void w32_service_uninstall(w32_service *s);
+/** Start all services in this process */
+int w32_services_start();
+
+#endif /* __W32_SERVICE_H */
Index: shared/getopt.c
===================================================================
--- shared/getopt.c	(.../vendor/clamav/current)	(revision 845)
+++ shared/getopt.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -41,7 +41,9 @@
 
 #include <stdio.h>
 
+#ifndef C_WIN32
 int strncmp(const char *s1, const char *s2, size_t n);
+#endif
 
 /* Comment out all this code if we are using the GNU C Library, and are not
    actually compiling the library itself.  This code is part of the GNU C
Index: shared/memory.c
===================================================================
--- shared/memory.c	(.../vendor/clamav/current)	(revision 845)
+++ shared/memory.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -16,9 +16,18 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 
 void *mmalloc(size_t size)
 {
Index: shared/w32_service.c
===================================================================
--- shared/w32_service.c	(.../vendor/clamav/current)	(revision 0)
+++ shared/w32_service.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,536 @@
+/*
+ *  Copyright (C) 2005 Mark Weaver <mark@npsl.co.uk>
+ *
+ *  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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <tchar.h>
+#include "w32_service.h"
+
+#if !defined(_M_IX86)
+#error Unsupported architecture
+#endif
+
+static w32_service_thunk *w32_service_thunk_create(void *func, void *arg);
+static void w32_service_thunk_destroy(w32_service_thunk *thunk);
+static void w32_service_stop(w32_service *s);
+static void w32_service_pause(w32_service *s);
+static void w32_service_shutdown(w32_service *s);
+static void w32_service_continue(w32_service *s);
+static void w32_service_interrogate(w32_service *s);
+static LPTSTR GetErrorMessage(DWORD dwErr);
+static void ReportError(LPCTSTR lpPrefix, DWORD dwErr);
+static void w32_service_handler(w32_service *s, DWORD fdwControl);
+static void w32_service_update_scm(w32_service *s, DWORD state, DWORD check_point, DWORD wait_hint);
+static void WINAPI w32_api_service_main(w32_service *s, DWORD dwArgc, LPTSTR* lpszArgv);
+static void WINAPI w32_api_service_handler(w32_service *s, DWORD fdwControl);
+static DWORD w32_service_main(w32_service *s, DWORD argc, LPTSTR *argv);
+
+static w32_service	*g_first_service;
+
+/**
+ * Make a thunk
+ */
+static w32_service_thunk *w32_service_thunk_create(void *func, void *arg)
+{
+	w32_service_thunk *t;
+	DWORD			  o;
+
+	t = VirtualAlloc(NULL, sizeof(w32_service_thunk), 
+					 MEM_COMMIT, PAGE_READWRITE);
+	if (t == NULL)
+		return NULL;
+
+	t->pushesp = 0xc72434ff;
+	t->movsp4[0] = 0x44;
+	t->movsp4[1] = 0x24;
+	t->movsp4[2] = 0x04;
+	t->arg = (DWORD)arg;
+	t->jmp = 0xe9;
+	t->func = (DWORD)((char *)func - (char *)t - sizeof(w32_service_thunk));
+
+	if (!VirtualProtect(t, sizeof(w32_service_thunk), PAGE_EXECUTE, &o))
+	{
+		VirtualFree(t, 0, MEM_RELEASE);
+		return NULL;
+	}
+	FlushInstructionCache(GetCurrentProcess(), t, sizeof(w32_service_thunk));
+	return t;
+}
+
+/**
+ * Destroy a thunk
+ */
+static void w32_service_thunk_destroy(w32_service_thunk *t)
+{
+	VirtualFree(t, 0, MEM_RELEASE);
+	FlushInstructionCache(GetCurrentProcess(), t, sizeof(w32_service_thunk));
+}
+
+/**
+ * Make a service object
+ */
+int w32_service_create(w32_service *s)
+{
+	s->next = g_first_service;
+	g_first_service = s;
+
+	s->name = NULL;
+	s->display_name = NULL;
+	s->description = NULL;
+	s->desired_access = STANDARD_RIGHTS_REQUIRED;
+	s->service_type = SERVICE_WIN32_OWN_PROCESS;
+	s->start_type = SERVICE_AUTO_START;
+	s->error_control = SERVICE_ERROR_NORMAL;
+	s->binary_path_name = NULL;
+	s->load_order_group = NULL;
+	s->dependencies = NULL;
+	s->start_name = NULL;
+	s->password = NULL;
+	s->stop = w32_service_stop;
+	s->pause = w32_service_pause;
+	s->continue_ = w32_service_continue;
+	s->shutdown = w32_service_shutdown;
+	s->interrogate = w32_service_interrogate;
+	s->handler = w32_service_handler;
+	s->main = w32_service_main;
+	s->update_scm = w32_service_update_scm;
+
+	s->main_thunk = w32_service_thunk_create(w32_api_service_main, s);
+	if (!s->main_thunk)
+		return 0;
+	s->handler_thunk = w32_service_thunk_create(w32_api_service_handler, s);
+	if (!s->handler_thunk)
+	{
+		w32_service_thunk_destroy(s->main_thunk);
+		return 0;
+	}
+	return 1;
+}
+
+static void w32_service_stop(w32_service *s)
+{
+	s;
+}
+
+static void w32_service_shutdown(w32_service *s)
+{
+	s;
+}
+
+static void w32_service_pause(w32_service *s)
+{
+	s;
+}
+
+static void w32_service_continue(w32_service *s)
+{
+	s;
+}
+
+static void w32_service_interrogate(w32_service *s)
+{
+	s->update_scm(s, SERVICE_RUNNING, 0, 1000);
+}
+
+static DWORD w32_service_main(w32_service *s, DWORD argc, LPTSTR *argv)
+{
+	s;
+	argc;
+	argv;
+	return 0;
+}
+
+static LPTSTR GetErrorMessage(DWORD dwErr)
+{
+	LPVOID lpBuffer;
+	if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, /* flags */
+				  0, /* source (if hmodule/string) */
+				  dwErr, /* message id */
+				  0, /* lang id */
+				  (LPTSTR)&lpBuffer, /* output buffer */
+				  0, /* max char count */
+				  NULL) == 0) /* args */
+		return NULL;
+	return (LPTSTR)lpBuffer;
+}
+
+static void ReportError(LPCTSTR lpPrefix, DWORD dwErr)
+{
+	LPTSTR msg = GetErrorMessage(dwErr);
+	if (msg == NULL) {
+		_ftprintf(stderr, _T("%s, error code = %d\n"), lpPrefix, dwErr);
+	} else {
+		_ftprintf(stderr, _T("%s: %s\n"), lpPrefix, msg);
+		if (msg) LocalFree(msg);
+	}
+}
+
+void w32_service_install(w32_service *s)
+{
+	TCHAR path[MAX_PATH];
+	SC_HANDLE hSM;
+	SC_HANDLE hService;
+	TCHAR EventLogKeyName[MAX_PATH];
+	HKEY hk;
+	LONG lErr;
+	DWORD dwData;
+	HMODULE hADVAPI;
+
+	hSM = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CREATE_SERVICE);
+	if (hSM == NULL) {
+		ReportError(_T("OpenSCManager"),GetLastError());
+		return;
+	}
+
+	if (!s->binary_path_name)
+	{
+		TCHAR module_path[MAX_PATH];
+		if (!GetModuleFileName(NULL, module_path, MAX_PATH))
+		{
+			ReportError(_T("GetModuleFileName"),GetLastError());
+			CloseServiceHandle(hSM);
+			return;
+		}
+		_sntprintf(path, MAX_PATH, _T("%s --service"), module_path);
+		path[MAX_PATH - 1] = _T('\0');
+	}
+
+	hService = CreateService(
+					hSM,  /* service manager */
+					s->name, /* net stop name */
+					s->display_name, /* friendly name */
+					SERVICE_CHANGE_CONFIG|s->desired_access, /* default access to interrogate/start/stop */
+					s->service_type, /* this process runs only 1 service */
+					s->start_type, /* start on boot */
+					s->error_control, /* log error/display message box */
+					s->binary_path_name ? s->binary_path_name : path, /* module path */
+					s->load_order_group, /* load order group */
+					NULL, /* load order tag */
+					s->dependencies, /* dependencies */
+					s->start_name, /* run under local system account */
+					s->password /* no password */
+					);
+	if (!hService) {
+
+		/* If the service already exists, then try and update the settings to
+		   the new ones */
+		if (GetLastError() == ERROR_SERVICE_EXISTS)
+		{
+			hService = OpenService(hSM, s->name, SERVICE_ALL_ACCESS);
+			if (!hService)
+			{
+				ReportError(_T("The service exists, but could not be opened to update the settings"),GetLastError());
+			} 
+			else 
+			{
+				BOOL bRet;
+				DWORD dwBytesNeeded;
+				LPBYTE pServiceConfig = (LPBYTE)LocalAlloc(LPTR, sizeof(QUERY_SERVICE_CONFIG)+1024);
+
+				if (!pServiceConfig)
+				{
+					ReportError(_T("Out of memory"),GetLastError());
+					CloseServiceHandle(hService);
+					CloseServiceHandle(hSM);
+					return;
+				}
+				dwBytesNeeded = 0;
+				bRet = QueryServiceConfig(hService, (LPQUERY_SERVICE_CONFIG)pServiceConfig, 
+											   sizeof(QUERY_SERVICE_CONFIG), &dwBytesNeeded);
+				if (!bRet)
+				{
+					if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
+						ReportError(_T("QueryServiceConfig failed"),GetLastError());
+					else
+					{
+						LocalFree(pServiceConfig);
+						pServiceConfig = (LPBYTE)LocalAlloc(LPTR, dwBytesNeeded);
+						if (!pServiceConfig)
+						{
+							ReportError(_T("Out of memory"),GetLastError());
+							CloseServiceHandle(hService);
+							CloseServiceHandle(hSM);
+							return;
+						}
+					}
+					bRet = QueryServiceConfig(hService, (LPQUERY_SERVICE_CONFIG)pServiceConfig,
+											  dwBytesNeeded, &dwBytesNeeded);
+				}
+
+				if (bRet)
+				{
+					LPQUERY_SERVICE_CONFIG pTheConfig = (LPQUERY_SERVICE_CONFIG)pServiceConfig;
+
+					if (!ChangeServiceConfig(hService, s->service_type, pTheConfig->dwStartType, s->error_control, 
+						s->binary_path_name ? s->binary_path_name : path, s->load_order_group, NULL, 
+						s->dependencies, s->start_name, s->password, s->display_name))
+					{
+						ReportError(_T("The service exists, but the configuration could not be updated"),GetLastError());
+					}
+				}
+				if (pServiceConfig)
+					LocalFree(pServiceConfig);
+			}
+		}
+		else
+		{
+			ReportError(_T("CreateService failed"),GetLastError());
+		}
+	}
+	
+	/* Set the long description if possible (NT5+) */
+	hADVAPI = LoadLibrary(_T("advapi32.dll"));
+	if (hADVAPI)
+	{
+		typedef BOOL (WINAPI *ChangeServiceConfig2_fn)(SC_HANDLE hService, DWORD dwInfoLevel, LPVOID lpInfo);
+		ChangeServiceConfig2_fn pChangeServiceConfig2;
+		SERVICE_DESCRIPTION desc;
+
+
+		pChangeServiceConfig2 = (ChangeServiceConfig2_fn)GetProcAddress(hADVAPI, 
+#ifdef _UNICODE
+			"ChangeServiceConfig2W"
+#else
+			"ChangeServiceConfig2A"
+#endif
+			);
+
+		if (pChangeServiceConfig2) 
+		{
+			desc.lpDescription = _tcsdup(s->description ? s->description : "");
+			if (desc.lpDescription == NULL) 
+			{
+				ReportError(_T("Couldn't copy description string"), ERROR_OUTOFMEMORY);
+				/* continue anyway */
+			} 
+			else 
+			{
+				if (!pChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &desc))
+				{
+					ReportError(_T("ChangeServiceConfig2 failed, ignoring"), GetLastError());
+				}
+				free(desc.lpDescription);
+			}
+		}
+		FreeLibrary(hADVAPI);
+	}
+
+	CloseServiceHandle(hSM);
+	CloseServiceHandle(hService);
+
+	_sntprintf(EventLogKeyName, MAX_PATH, _T("SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s"), s->name);
+	EventLogKeyName[MAX_PATH - 1] = _T('\0');
+
+	/* register the app as an event source */
+	if ((lErr=RegCreateKey(HKEY_LOCAL_MACHINE,
+			EventLogKeyName,
+			&hk)) != ERROR_SUCCESS) {
+		ReportError(_T("RegCreateKey for event source"),lErr);
+		return;
+	}
+
+	/* set the name of the message file */
+	if ((lErr=RegSetValueEx(hk, _T("EventMessageFile"), 0, REG_EXPAND_SZ, 
+			(LPCBYTE)(s->binary_path_name ? s->binary_path_name : path), 
+			(DWORD)((_tcslen(path)+1)*sizeof(TCHAR)))) != ERROR_SUCCESS) 
+	{
+		ReportError(_T("RegSetValueEx for EventMessageFile"),lErr);
+		RegCloseKey(hk);
+		return;
+	}
+
+	/* set the supported event types in the TypesSupported value */
+	dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
+	if ((lErr=RegSetValueEx(hk, _T("TypesSupported"), 0, REG_DWORD, (LPBYTE)&dwData, sizeof(DWORD))) !=
+		ERROR_SUCCESS) {
+		ReportError(_T("RegSetValueEx for TypesSupported"),lErr);
+		RegCloseKey(hk);
+		return;
+	}
+	RegCloseKey(hk);
+}
+
+void w32_service_uninstall(w32_service *s)
+{
+	SC_HANDLE hSM;
+	SC_HANDLE hService;
+	LONG lErr;
+	TCHAR EventLogKeyName[MAX_PATH];
+	
+	hSM = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
+	if (hSM == NULL) {
+		ReportError(_T("OpenSCManager for deletion"),GetLastError());
+		return;
+	}
+	hService = OpenService(hSM, s->name, STANDARD_RIGHTS_REQUIRED);
+	if (hService == NULL) {
+		ReportError(_T("OpenService for deletion"),GetLastError());
+		CloseServiceHandle(hSM);
+		return;
+	}
+	if (!DeleteService(hService)) {
+		ReportError(_T("DeleteService"),GetLastError());
+		CloseServiceHandle(hService);
+		CloseServiceHandle(hSM);
+		return;
+	}
+	CloseServiceHandle(hService);
+	CloseServiceHandle(hSM);
+
+	/* work out the name of the event log key */
+	_sntprintf(EventLogKeyName, MAX_PATH, _T("SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s"), s->name);
+	EventLogKeyName[MAX_PATH - 1] = _T('\0');
+
+	/* delete registry key for event source */
+	if ((lErr=RegDeleteKey(HKEY_LOCAL_MACHINE, EventLogKeyName)) != ERROR_SUCCESS) {
+		ReportError(_T("RegDeleteKey for event viewer source"),lErr);
+		return;
+	}
+}
+
+int w32_services_start()
+{
+	DWORD				services, i;
+	int					ret = 0;
+	w32_service			*s;
+	SERVICE_TABLE_ENTRY *dispatchTable = 0;
+
+	/* Count services */
+	services = 0;
+	for (s = g_first_service; s; s = s->next)
+		++services;
+	if (!services)
+		goto err;
+
+	/* Make a dispatch table.  Need to copy service names (broken API?) */
+	dispatchTable = malloc(sizeof(SERVICE_TABLE_ENTRY) * (1 + services));
+	if (dispatchTable == NULL) {
+		SetLastError(ERROR_OUTOFMEMORY);
+		goto err;
+	}
+	for (i = 0, s = g_first_service; s; s = s->next, ++i) {
+		dispatchTable[i].lpServiceName = _tcsdup(s->name);
+		if (dispatchTable[i].lpServiceName == NULL) {
+			SetLastError(ERROR_OUTOFMEMORY);
+			goto err;
+		}
+		dispatchTable[i].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)s->main_thunk;
+	}
+	dispatchTable[i].lpServiceName = NULL;
+	dispatchTable[i].lpServiceProc = NULL;
+
+	/* Kick them off */
+	if (StartServiceCtrlDispatcher(dispatchTable))
+		ret = 1;
+
+err:
+	if (dispatchTable) {
+		for (i = 0; i < services; ++i) {
+			free(dispatchTable[i].lpServiceName);
+		}
+		free(dispatchTable);
+	}
+	if (!ret) {
+		ReportError(_T("Starting services failed"), GetLastError());
+	}
+	return ret;
+}
+
+/*
+ * Tell the Service Control Manager the state of the service
+ */
+static void w32_service_update_scm(w32_service *s, DWORD state, DWORD check_point, DWORD wait_hint)
+{
+	SERVICE_STATUS ss;
+
+	if (s->service_status)
+	{
+		memset(&ss, 0, sizeof(SERVICE_STATUS));
+		ss.dwServiceType = s->service_type;
+		ss.dwCurrentState = state;
+		ss.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
+		ss.dwCheckPoint = check_point;
+		ss.dwServiceSpecificExitCode = 0;
+		ss.dwWin32ExitCode = NO_ERROR;
+		ss.dwWaitHint = wait_hint;
+
+		if (!SetServiceStatus(s->service_status, &ss))
+		{
+			ss.dwCurrentState = SERVICE_STOPPED;
+			SetServiceStatus(s->service_status, &ss);
+		}
+	}
+}
+
+static void w32_service_handler(w32_service *s, DWORD fdwControl)
+{
+	switch (fdwControl) {
+	case SERVICE_CONTROL_STOP:
+		s->stop(s);
+		break;
+
+	case SERVICE_CONTROL_PAUSE:
+		s->pause(s);
+		break;
+
+	case SERVICE_CONTROL_CONTINUE:
+		s->continue_(s);
+		break;
+
+	case SERVICE_CONTROL_SHUTDOWN:
+		s->shutdown(s);
+		break;
+
+	case SERVICE_CONTROL_INTERROGATE:
+		s->interrogate(s);
+		break;
+	}
+}
+
+/* Win32 callbacks with thunks */
+static void WINAPI w32_api_service_main(w32_service *s, DWORD argc, LPTSTR* argv)
+{
+	/* Register the callback */
+	s->service_status = RegisterServiceCtrlHandler(s->name, (LPHANDLER_FUNCTION)s->handler_thunk);
+
+	/* Initialise the status object */
+	if (s->service_status)
+	{
+		SERVICE_STATUS ss;
+
+		memset(&ss, 0, sizeof(SERVICE_STATUS));
+		ss.dwServiceType = s->service_type;
+		ss.dwCurrentState = SERVICE_START_PENDING;
+		ss.dwControlsAccepted = 0;
+		ss.dwCheckPoint = 0;
+		ss.dwServiceSpecificExitCode = 0;
+		ss.dwWin32ExitCode = 0;
+		ss.dwWaitHint = 60000;
+
+		(void)SetServiceStatus(s->service_status, &ss);
+		ss.dwWin32ExitCode = s->main(s, argc, argv);
+		ss.dwWaitHint = 0;
+		ss.dwCurrentState = SERVICE_STOPPED;
+		(void)SetServiceStatus(s->service_status, &ss);
+	}
+}
+
+static void WINAPI w32_api_service_handler(w32_service *s, DWORD fdwControl)
+{
+	s->handler(s, fdwControl);
+}
Index: shared/misc.c
===================================================================
--- shared/misc.c	(.../vendor/clamav/current)	(revision 845)
+++ shared/misc.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -22,13 +22,20 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 #include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#include <tchar.h>
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+
 #include "clamav.h"
 #include "cfgparser.h"
 #include "memory.h"
@@ -41,31 +48,37 @@
 	struct cfgstruct *copt = NULL, *cpt;
 	const char *dbdir;
 	char *retdir;
+	char *confPath = NULL;
 
+	confPath = cl_retconfpath("clamd.conf");
+
     /* try to find fresh directory */
     dbdir = cl_retdbdir();
-    if((copt = parsecfg(CONFDIR"/clamd.conf", 0))) {
-	if((cpt = cfgopt(copt, "DatabaseDirectory")) || (cpt = cfgopt(copt, "DataDirectory"))) {
-	    if(strcmp(dbdir, cpt->strarg)) {
-		    char *daily = (char *) mmalloc(strlen(cpt->strarg) + strlen(dbdir) + 15);
-		sprintf(daily, "%s/daily.cvd", cpt->strarg);
-		if((d1 = cl_cvdhead(daily))) {
-		    sprintf(daily, "%s/daily.cvd", dbdir);
-		    if((d2 = cl_cvdhead(daily))) {
-			free(daily);
-			if(d1->version > d2->version)
-			    dbdir = cpt->strarg;
-			cl_cvdfree(d2);
-		    } else {
-			free(daily);
-			dbdir = cpt->strarg;
-		    }
-		    cl_cvdfree(d1);
-		} else {
-		    free(daily);
+	if(confPath) {
+		if (copt = parsecfg(confPath, 0)) {
+		if((cpt = cfgopt(copt, "DatabaseDirectory")) || (cpt = cfgopt(copt, "DataDirectory"))) {
+			if(strcmp(dbdir, cpt->strarg)) {
+				char *daily = (char *) mmalloc(strlen(cpt->strarg) + strlen(dbdir) + 15);
+			sprintf(daily, "%s" PATH_SEPARATOR "daily.cvd", cpt->strarg);
+			if((d1 = cl_cvdhead(daily))) {
+				sprintf(daily, "%s" PATH_SEPARATOR "daily.cvd", dbdir);
+				if((d2 = cl_cvdhead(daily))) {
+				free(daily);
+				if(d1->version > d2->version)
+					dbdir = cpt->strarg;
+				cl_cvdfree(d2);
+				} else {
+				free(daily);
+				dbdir = cpt->strarg;
+				}
+				cl_cvdfree(d1);
+			} else {
+				free(daily);
+			}
+			}
 		}
-	    }
-	}
+		}
+		free(confPath);
     }
 
     retdir = strdup(dbdir);
@@ -89,7 +102,7 @@
 	return;
     }
 
-    sprintf(path, "%s/daily.cvd", dbdir);
+    sprintf(path, "%s" PATH_SEPARATOR "daily.cvd", dbdir);
     free(dbdir);
 
     if((daily = cl_cvdhead(path))) {
@@ -133,10 +146,14 @@
 	char buffer[FILEBUFF];
 	int s, d, bytes;
 
-    if((s = open(src, O_RDONLY)) == -1)
+    if((s = open(src, O_BINARY|O_RDONLY)) == -1)
 	return -1;
 
-    if((d = open(dest, O_CREAT|O_WRONLY|O_TRUNC)) == -1) {
+#ifdef C_WIN32
+    if((d = open(dest, O_BINARY|O_CREAT|O_WRONLY|O_TRUNC, S_IREAD|S_IWRITE)) == -1) {
+#else
+    if((d = open(dest, O_BINARY|O_CREAT|O_WRONLY|O_TRUNC)) == -1) {
+#endif
 	close(s);
 	return -1;
     }
Index: shared/cfgparser.c
===================================================================
--- shared/cfgparser.c	(.../vendor/clamav/current)	(revision 845)
+++ shared/cfgparser.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -119,7 +119,7 @@
 	};
 
 
-    if((fs = fopen(cfgfile, "r")) == NULL)
+    if((fs = fopen(cfgfile, "rt")) == NULL)
 	return NULL;
 
     while(fgets(buff, LINE_LENGTH, fs)) {
@@ -156,6 +156,7 @@
 				copt = regcfg(copt, name, arg, 0);
 				break;
 			    case OPT_FULLSTR:
+				{
 				if(!arg) {
 				    if(messages)
 					fprintf(stderr, "ERROR: Parse error at line %d: Option %s requires string as argument.\n", line, name);
@@ -170,6 +171,7 @@
 				    *c = '\0';
 				copt = regcfg(copt, name, arg, 0);
 				break;
+				}
 			    case OPT_NUM:
 				if(!arg || !isnumb(arg)) {
 				    if(messages)
Index: w32confgen/w32confgen.c
===================================================================
--- w32confgen/w32confgen.c	(.../vendor/clamav/current)	(revision 0)
+++ w32confgen/w32confgen.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,520 @@
+/*
+ *  Copyright (C) 2005 Mark Weaver <mark@npsl.co.uk>
+ *
+ *  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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <windows.h>
+#include <tchar.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int writefreshclam(const char *confDir, const char *dataDir, const char *logDir)
+{
+	char confPath[MAX_PATH + 20];
+	FILE *f;
+	_snprintf(confPath, sizeof(confPath), "%s\\freshclam.conf", confDir);
+	confPath[sizeof(confPath) - 1] = '\0';
+
+	f = fopen(confPath, "wb");
+	if (f == NULL) {
+		fprintf(stderr, "Failed to open %s for writing\n", confPath);
+		return 1;
+	}
+	fprintf(f, 
+"##\n"
+"## Example config file for freshclam\n"
+"## Please read the freshclam.conf(5) manual before editing this file.\n"
+"## This file may be optionally merged with clamd.conf.\n"
+"##\n"
+"\n"
+"\n"
+"# Comment or remove the line below.\n"
+"#Example\n"
+"\n"
+"# Path to the database directory.\n"
+"# WARNING: It must match clamd.conf's directive!\n"
+"# Default: hardcoded (depends on installation options)\n");
+	fprintf(f, "DatabaseDirectory %s\n", dataDir);
+	fprintf(f,
+"\n"
+"# Path to the log file (make sure it has proper permissions)\n"
+"# Default: disabled\n");
+	fprintf(f,
+"UpdateLogFile %s\\freshclam.log\n", logDir);
+	fprintf(f, 
+"\n"
+"# Enable verbose logging.\n"
+"# Default: disabled\n"
+"# LogVerbose\n"
+"\n"
+"# Use system logger (can work together with UpdateLogFile).\n"
+"# Default: disabled\n"
+"#LogSyslog\n"
+"\n"
+"# Specify the type of syslog messages - please refer to 'man syslog'\n"
+"# for facility names.\n"
+"# Default: LOG_LOCAL6\n"
+"#LogFacility LOG_MAIL\n"
+"\n"
+"# This option allows you to save the process identifier of the daemon\n"
+"# Default: disabled\n"
+"# PidFile c:\\clamav-devel\\freshclam.pid\n"
+"\n"
+"# By default when started freshclam drops privileges and switches to the\n"
+"# \"clamav\" user. This directive allows you to change the database owner.\n"
+"# Default: clamav (may depend on installation options)\n"
+"#DatabaseOwner clamav\n"
+"\n"
+"# Initialize supplementary group access (freshclam must be started by root).\n"
+"# Default: disabled\n"
+"AllowSupplementaryGroups\n"
+"\n"
+"# Use DNS to verify virus database version. Freshclam uses DNS TXT records\n"
+"# to verify database and software versions. With this directive you can change\n"
+"# the database verification domain.\n"
+"# Default: enabled, pointing to current.cvd.clamav.net\n"
+"DNSDatabaseInfo current.cvd.clamav.net\n"
+"\n"
+"# Uncomment the following line and replace XY with your country\n"
+"# code. See http://www.iana.org/cctld/cctld-whois.htm for the full list.\n"
+"# Default: There is no default, which results in an error when running freshclam\n"
+"#DatabaseMirror db.XY.clamav.net\n"
+"\n"
+"# database.clamav.net is a round-robin record which points to our most \n"
+"# reliable mirrors. It's used as a fall back in case db.XY.clamav.net is \n"
+"# not working. DO NOT TOUCH the following line unless you know what you\n"
+"# are doing.\n"
+"DatabaseMirror database.clamav.net\n"
+"\n"
+"# How many attempts to make before giving up.\n"
+"# Default: 3 (per mirror)\n"
+"MaxAttempts 3\n"
+"\n"
+"# Number of database checks per day.\n"
+"# Default: 12 (every two hours)\n"
+"Checks 12\n"
+"#\n"
+"\n"
+"# Proxy settings\n"
+"# Default: disabled\n"
+"#HTTPProxyServer myproxy.com\n"
+"#HTTPProxyPort 1234\n"
+"#HTTPProxyUsername myusername\n"
+"#HTTPProxyPassword mypass\n"
+"\n"
+"# Use aaa.bbb.ccc.ddd as client address for downloading databases. Useful for\n"
+"# multi-homed systems.\n"
+"# Default: Use OS'es default outgoing IP address.\n"
+"#LocalIPAddress aaa.bbb.ccc.ddd\n"
+"\n"
+"# Send the RELOAD command to clamd.\n"
+"# Default: disabled\n"
+"NotifyClamd\n"
+"# By default it uses the hardcoded configuration file but you can force an\n"
+"# another one.\n");
+	fprintf(f,
+"NotifyClamd %s\\clamd.conf", confDir);
+	fprintf(f, 
+		"\n"
+"\n"
+"# Run command after successful database update.\n"
+"# Default: disabled\n"
+"# OnUpdateExecute c:\\foo.bat\n"
+"\n"
+"# Run command when database update process fails.\n"
+"# Default: disabled\n"
+"#OnErrorExecute command\n"
+"\n"
+"# Don't fork into background.\n"
+"# Default: disabled\n"
+"#Foreground\n"
+"\n"
+"# Enable debug messages in libclamav.\n"
+"# Default: disabled\n"
+"#Debug\n");
+	fflush(f);
+	fclose(f);
+	return 0;
+}
+
+int writeclamd(const char *confDir, const char *dataDir, const char *logDir)
+{
+	char confPath[MAX_PATH + 20];
+	FILE *f;
+	_snprintf(confPath, sizeof(confPath), "%s\\clamd.conf", confDir);
+	confPath[sizeof(confPath) - 1] = '\0';
+
+	f = fopen(confPath, "wb");
+	if (f == NULL) {
+		fprintf(stderr, "Failed to open %s for writing\n", confPath);
+		return 1;
+	}
+	fprintf(f, 
+"##\n"
+"## Example config file for the Clam AV daemon\n"
+"## Please read the clamd.conf(5) manual before editing this file.\n"
+"##\n"
+"\n"
+"\n"
+"# Comment or remove the line below.\n"
+"#Example\n"
+"\n"
+"# Uncomment this option to enable logging.\n"
+"# LogFile must be writable for the user running daemon.\n"
+"# A full path is required.\n"
+"# Default: disabled\n");
+	fprintf(f,
+"LogFile %s\\clamd.log", logDir);
+	fprintf(f,
+"\n"
+"\n"
+"# By default the log file is locked for writing - the lock protects against\n"
+"# running clamd multiple times (if want to run another clamd, please\n"
+"# copy the configuration file, change the LogFile variable, and run\n"
+"# the daemon with --config-file option).\n"
+"# This option disables log file locking.\n"
+"# Default: disabled\n"
+"#LogFileUnlock\n"
+"\n"
+"# Maximal size of the log file.\n"
+"# Value of 0 disables the limit.\n"
+"# You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes)\n"
+"# and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). To specify the size\n"
+"# in bytes just don't use modifiers.\n"
+"# Default: 1M\n"
+"LogFileMaxSize 1M\n"
+"\n"
+"# Log time with each message.\n"
+"# Default: disabled\n"
+"LogTime\n"
+"\n"
+"# Also log clean files. Useful in debugging but drastically increases the\n"
+"# log size.\n"
+"# Default: disabled\n"
+"#LogClean\n"
+"\n"
+"# Use system logger (can work together with LogFile).\n"
+"# Default: disabled\n"
+"#LogSyslog\n"
+"\n"
+"# Specify the type of syslog messages - please refer to 'man syslog'\n"
+"# for facility names.\n"
+"# Default: LOG_LOCAL6\n"
+"#LogFacility LOG_MAIL\n"
+"\n"
+"# Enable verbose logging.\n"
+"# Default: disabled\n"
+"#LogVerbose\n"
+"\n"
+"# This option allows you to save a process identifier of the listening\n"
+"# daemon (main thread).\n"
+"# Default: disabled\n"
+"#PidFile c:\\clamav-devel\\clamd.pid\n"
+"\n"
+"# Optional path to the global temporary directory.\n"
+"# Default: system specific (usually /tmp or /var/tmp).\n"
+"# TemporaryDirectory c:\\clamav-devel\\tmp\n"
+"\n"
+"# Path to the database directory.\n"
+"# Default: hardcoded (depends on installation options)\n");
+	fprintf(f, "DatabaseDirectory %s\n", dataDir);
+	fprintf(f,
+"\n"
+"# The daemon works in a local OR a network mode. Due to security reasons we\n"
+"# recommend the local mode.\n"
+"\n"
+"# Path to a local socket file the daemon will listen on.\n"
+"# Default: disabled\n"
+"# LocalSocket /cygdrive/c/clamav-devel/clamd.sock\n"
+"\n"
+"# Remove stale socket after unclean shutdown.\n"
+"# Default: disabled\n"
+"FixStaleSocket\n"
+"\n"
+"\n"
+"# UNCOMMENT THE FOLLOWING TWO OPTIONS IF YOU WANT\n"
+"# CLAMAV TO RUN IN TCP/IP MODE, WHICH MAY SOLVE SOME\n"
+"# STABILITY ISSUES ON SOME VERSIONS OF WINDOWS\n"
+"#====================================================\n"
+"\n"
+"# TCP port address.\n"
+"# Default: disabled\n"
+"TCPSocket 3310\n"
+"\n"
+"# TCP address.\n"
+"# By default we bind to INADDR_ANY, probably not wise.\n"
+"# Enable the following to provide some degree of protection\n"
+"# from the outside world.\n"
+"# Default: disabled\n"
+"TCPAddr 127.0.0.1\n"
+"\n"
+"#====================================================\n"
+"\n"
+"# Maximum length the queue of pending connections may grow to.\n"
+"# Default: 15\n"
+"MaxConnectionQueueLength 15\n"
+"\n"
+"# Clamd uses FTP-like protocol to receive data from remote clients.\n"
+"# If you are using clamav-milter to balance load between remote clamd daemons\n"
+"# on firewall servers you may need to tune the options below.\n"
+"\n"
+"# Close the connection when the data size limit is exceeded.\n"
+"# The value should match your MTA's limit for a maximal attachment size.\n"
+"# Default: 10M\n"
+"StreamMaxLength 5M\n"
+"\n"
+"# Limit port range.\n"
+"# Default: 1024\n"
+"StreamMinPort 30000\n"
+"# Default: 2048\n"
+"StreamMaxPort 32000\n"
+"\n"
+"# Maximal number of threads running at the same time.\n"
+"# Default: 10\n"
+"MaxThreads 10\n"
+"\n"
+"# Waiting for data from a client socket will timeout after this time (seconds).\n"
+"# Value of 0 disables the timeout.\n"
+"# Default: 120\n"
+"ReadTimeout 60\n"
+"\n"
+"# Waiting for a new job will timeout after this time (seconds).\n"
+"# Default: 30\n"
+"IdleTimeout 30\n"
+"\n"
+"# Maximal depth directories are scanned at.\n"
+"# Default: 15\n"
+"MaxDirectoryRecursion 15\n"
+"\n"
+"# Follow directory symlinks.\n"
+"# Default: disabled\n"
+"FollowDirectorySymlinks\n"
+"\n"
+"# Follow regular file symlinks.\n"
+"# Default: disabled\n"
+"FollowFileSymlinks\n"
+"\n"
+"# Perform internal sanity check (database integrity and freshness).\n"
+"# Default: 1800 (30 min)\n"
+"SelfCheck 900\n"
+"\n"
+"# THIS IS KNOWN TO NOT WORK\n"
+"# Execute a command when virus is found. In the command string %%v will\n"
+"# be replaced by a virus name.\n"
+"# Default: disabled\n"
+"#VirusEvent /usr/local/bin/send_sms 123456789 \"VIRUS ALERT: %%v\"\n"
+"\n"
+"# Run as a selected user (clamd must be started by root).\n"
+"# Default: disabled\n"
+"#User clamav\n"
+"\n"
+"# Initialize supplementary group access (clamd must be started by root).\n"
+"# Default: disabled\n"
+"AllowSupplementaryGroups\n"
+"\n"
+"# Stop daemon when libclamav reports out of memory condition.\n"
+"#ExitOnOOM\n"
+"\n"
+"# Don't fork into background.\n"
+"# Default: disabled\n"
+"#Foreground\n"
+"\n"
+"# Enable debug messages in libclamav.\n"
+"# Default: disabled\n"
+"# Debug\n"
+"\n"
+"# Do not remove temporary files (for debug purposes).\n"
+"# Default: disabled\n"
+"#LeaveTemporaryFiles\n"
+"\n"
+"\n"
+"# By default clamd uses scan options recommended by libclamav. This option\n"
+"# disables recommended options and allows you to enable selected ones below.\n"
+"# DO NOT TOUCH IT unless you know what you are doing.\n"
+"# Default: disabled\n"
+"#DisableDefaultScanOptions\n"
+"\n"
+"##\n"
+"## Executable files\n"
+"##\n"
+"\n"
+"# PE stands for Portable Executable - it's an executable file format used\n"
+"# in all 32-bit versions of Windows operating systems. This option allows\n"
+"# ClamAV to perform a deeper analysis of executable files and it's also\n"
+"# required for decompression of popular executable packers such as UPX, FSG,\n"
+"# and Petite.\n"
+"# Default: enabled\n"
+"ScanPE\n"
+"\n"
+"# With this option clamav will try to detect broken executables and mark\n"
+"# them as Broken.Executable\n"
+"# Default: disabled\n"
+"#DetectBrokenExecutables\n"
+"\n"
+"\n"
+"##\n"
+"## Documents\n"
+"##\n"
+"\n"
+"# This option enables scanning of Microsoft Office document macros.\n"
+"# Default: enabled\n"
+"ScanOLE2\n"
+"\n"
+"##\n"
+"## Mail files\n"
+"##\n"
+"\n"
+"# Enable internal e-mail scanner.\n"
+"# Default: enabled\n"
+"ScanMail\n"
+"\n"
+"# If an email contains URLs ClamAV can download and scan them.\n"
+"# WARNING: This option may open your system to a DoS attack.\n"
+"#	   Never use it on loaded servers.\n"
+"# Default: disabled\n"
+"#MailFollowURLs\n"
+"\n"
+"\n"
+"##\n"
+"## HTML\n"
+"##\n"
+"\n"
+"# Perform HTML normalisation and decryption of MS Script Encoder code.\n"
+"# Default: enabled\n"
+"ScanHTML\n"
+"\n"
+"\n"
+"##\n"
+"## Archives\n"
+"##\n"
+"\n"
+"# ClamAV can scan within archives and compressed files.\n"
+"# Default: enabled\n"
+"ScanArchive\n"
+"\n"
+"# NOTE THAT CLAMAV NOW UNDERSTANDS v3.0 ARCHIVES\n"
+"# Due to license issues libclamav does not support RAR 3.0 archives (only the\n"
+"# old 2.0 format is supported). Because some users report stability problems\n"
+"# with unrarlib it's disabled by default and you must uncomment the directive\n"
+"# below to enable RAR 2.0 support.\n"
+"# Default: disabled\n"
+"ScanRAR\n"
+"\n"
+"# The options below protect your system against Denial of Service attacks\n"
+"# using archive bombs.\n"
+"\n"
+"# Files in archives larger than this limit won't be scanned.\n"
+"# Value of 0 disables the limit.\n"
+"# Default: 10M\n"
+"ArchiveMaxFileSize 5M\n"
+"\n"
+"# Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR\n"
+"# file, all files within it will also be scanned. This options specifies how\n"
+"# deep the process should be continued.\n"
+"# Value of 0 disables the limit.\n"
+"# Default: 8\n"
+"ArchiveMaxRecursion 8\n"
+"\n"
+"# Number of files to be scanned within an archive.\n"
+"# Value of 0 disables the limit.\n"
+"# Default: 1000\n"
+"ArchiveMaxFiles 500\n"
+"\n"
+"# If a file in an archive is compressed more than ArchiveMaxCompressionRatio\n"
+"# times it will be marked as a virus (Oversized.ArchiveType, e.g. Oversized.Zip)\n"
+"# Value of 0 disables the limit.\n"
+"# Default: 250\n"
+"ArchiveMaxCompressionRatio 250\n"
+"\n"
+"# Use slower but memory efficient decompression algorithm.\n"
+"# only affects the bzip2 decompressor.\n"
+"# Default: disabled\n"
+"#ArchiveLimitMemoryUsage\n"
+"\n"
+"# Mark encrypted archives as viruses (Encrypted.Zip, Encrypted.RAR).\n"
+"# Default: disabled\n"
+"#ArchiveBlockEncrypted\n"
+"\n"
+"# Mark archives as viruses (e.g. RAR.ExceededFileSize, Zip.ExceededFilesLimit)\n"
+"# if ArchiveMaxFiles, ArchiveMaxFileSize, or ArchiveMaxRecursion limit is\n"
+"# reached.\n"
+"# Default: disabled\n"
+"#ArchiveBlockMax\n");
+	fflush(f);
+	fclose(f);
+	return 0;
+}
+
+int main(int argc, char **argv)
+{
+	HKEY hKey;
+	LONG err;
+	char confDir[MAX_PATH], dataDir[MAX_PATH], logDir[MAX_PATH];
+	DWORD bufLen;
+	DWORD type=0;
+
+	/* try registry */
+	err = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\ClamAV"), &hKey);
+	if (err != ERROR_SUCCESS) {
+		fprintf(stderr, "Failed to open the registry key HKLM\\SOFTWARE\\ClamAV with %lu\n", 
+			GetLastError());
+		return 1;
+	}
+
+	bufLen = sizeof(confDir);
+	err = RegQueryValueExA(hKey, "ConfDir", NULL, &type, (LPBYTE)confDir, &bufLen);
+	if (err != ERROR_SUCCESS) {
+		fprintf(stderr, "Failed to read the registry value HKLM\\SOFTWARE\\ClamAV\\ConfDir with %lu\n",
+			GetLastError());
+		RegCloseKey(hKey);
+		return 1;
+	}
+	if (bufLen > 1 && confDir[bufLen - 2] == '\\')
+		confDir[bufLen - 2] = '\0';
+
+	bufLen = sizeof(dataDir);
+	err = RegQueryValueExA(hKey, "DataDir", NULL, &type, (LPBYTE)dataDir, &bufLen);
+	if (err != ERROR_SUCCESS) {
+		fprintf(stderr, "Failed to read the registry value HKLM\\SOFTWARE\\ClamAV\\DataDir with %lu\n",
+			GetLastError());
+		RegCloseKey(hKey);
+		return 1;
+	}
+	if (bufLen > 1 && dataDir[bufLen - 2] == '\\')
+		dataDir[bufLen - 2] = '\0';
+
+	bufLen = sizeof(logDir);
+	err = RegQueryValueExA(hKey, "LogDir", NULL, &type, (LPBYTE)logDir, &bufLen);
+	if (err != ERROR_SUCCESS) {
+		fprintf(stderr, "Failed to read the registry value HKLM\\SOFTWARE\\ClamAV\\LogDir with %lu\n",
+			GetLastError());
+		RegCloseKey(hKey);
+		return 1;
+	}
+	if (bufLen > 1 && logDir[bufLen - 2] == '\\')
+		logDir[bufLen - 2] = '\0';
+
+	RegCloseKey(hKey);
+
+	if (writeclamd(confDir,dataDir,logDir)) {
+		fprintf(stderr, "Generating clamd.conf failed\n");
+	}
+	if (writefreshclam(confDir,dataDir,logDir)) {
+		fprintf(stderr, "Generating freshclam.conf failed\n");
+	}
+	return 0;
+}

Property changes on: w32confgen/w32confgen.c
___________________________________________________________________
Name: svn:eol-style
   + native

Index: w32confgen/w32confgen.vcproj
===================================================================
--- w32confgen/w32confgen.vcproj	(.../vendor/clamav/current)	(revision 0)
+++ w32confgen/w32confgen.vcproj	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="w32confgen"
+	ProjectGUID="{36628872-DA7C-410E-BCCE-274212D29125}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\$(ProjectName)D.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName)D.pdb"
+				SubSystem="1"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\$(ProjectName).exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\w32confgen.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes on: w32confgen/w32confgen.vcproj
___________________________________________________________________
Name: svn:eol-style
   + CRLF

Index: clamd/clamd.vcproj
===================================================================
--- clamd/clamd.vcproj	(.../vendor/clamav/current)	(revision 0)
+++ clamd/clamd.vcproj	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="clamd"
+	ProjectGUID="{C08532DC-414E-4954-B395-33D60DCF06B5}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".,..,..\libclamav,..\shared"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib pthreadVC2.lib"
+				OutputFile="$(OutDir)\$(ProjectName)D.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName)D.pdb"
+				SubSystem="1"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".,..,..\libclamav,..\shared"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ws2_32.lib pthreadVC2.lib"
+				OutputFile="$(OutDir)\$(ProjectName).exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\clamd.c"
+				>
+			</File>
+			<File
+				RelativePath=".\clamuko.c"
+				>
+			</File>
+			<File
+				RelativePath=".\dazukoio.c"
+				>
+			</File>
+			<File
+				RelativePath=".\dazukoio_compat12.c"
+				>
+			</File>
+			<File
+				RelativePath=".\options.c"
+				>
+			</File>
+			<File
+				RelativePath=".\others.c"
+				>
+			</File>
+			<File
+				RelativePath=".\scanner.c"
+				>
+			</File>
+			<File
+				RelativePath=".\server-th.c"
+				>
+			</File>
+			<File
+				RelativePath=".\session.c"
+				>
+			</File>
+			<File
+				RelativePath=".\tcpserver.c"
+				>
+			</File>
+			<File
+				RelativePath=".\thrmgr.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\clamuko.h"
+				>
+			</File>
+			<File
+				RelativePath=".\dazuko_xp.h"
+				>
+			</File>
+			<File
+				RelativePath=".\dazukoio.h"
+				>
+			</File>
+			<File
+				RelativePath=".\dazukoio_compat12.h"
+				>
+			</File>
+			<File
+				RelativePath=".\dazukoio_xp.h"
+				>
+			</File>
+			<File
+				RelativePath=".\defaults.h"
+				>
+			</File>
+			<File
+				RelativePath=".\localserver.h"
+				>
+			</File>
+			<File
+				RelativePath=".\options.h"
+				>
+			</File>
+			<File
+				RelativePath=".\others.h"
+				>
+			</File>
+			<File
+				RelativePath=".\scanner.h"
+				>
+			</File>
+			<File
+				RelativePath=".\server.h"
+				>
+			</File>
+			<File
+				RelativePath=".\session.h"
+				>
+			</File>
+			<File
+				RelativePath=".\shared.h"
+				>
+			</File>
+			<File
+				RelativePath=".\tcpserver.h"
+				>
+			</File>
+			<File
+				RelativePath=".\thrmgr.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="shared"
+			>
+			<File
+				RelativePath="..\shared\cfgparser.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\cfgparser.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\getopt.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\memory.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\memory.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\misc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\misc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\output.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\output.h"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\w32_service.c"
+				>
+			</File>
+			<File
+				RelativePath="..\shared\w32_service.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes on: clamd/clamd.vcproj
___________________________________________________________________
Name: svn:eol-style
   + CRLF

Index: clamd/thrmgr.c
===================================================================
--- clamd/thrmgr.c	(.../vendor/clamav/current)	(revision 845)
+++ clamd/thrmgr.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -16,6 +16,10 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
 #include <pthread.h>
 #include <time.h>
 #include <errno.h>
@@ -40,6 +44,11 @@
 	return work_q;
 }
 
+void work_queue_destroy(work_queue_t *work_q)
+{
+	free(work_q);
+}
+
 void work_queue_add(work_queue_t *work_q, void *data)
 {
 	work_item_t *work_item;
@@ -113,6 +122,7 @@
 	pthread_mutex_destroy(&(threadpool->pool_mutex));
 	pthread_cond_destroy(&(threadpool->pool_cond));
 	pthread_attr_destroy(&(threadpool->pool_attr));
+	work_queue_destroy(threadpool->queue);
 	free(threadpool);
 	return;
 }
Index: clamd/others.c
===================================================================
--- clamd/others.c	(.../vendor/clamav/current)	(revision 845)
+++ clamd/others.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -24,20 +24,26 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <time.h>
 #include <sys/stat.h>
 #include <errno.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#include <process.h>
+#include <windows.h>
+#else
+#include <unistd.h>
 #include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#endif
 
 #if HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
 
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -68,12 +74,75 @@
 #include "memory.h"
 #include "cfgparser.h"
 #include "session.h"
+#include "output.h"
 
 #define ENV_FILE  "CLAM_VIRUSEVENT_FILENAME"
 #define ENV_VIRUS "CLAM_VIRUSEVENT_VIRUSNAME"
 
+#ifdef C_WIN32
 void virusaction(const char *filename, const char *virname, const struct cfgstruct *copt)
 {
+	struct cfgstruct *cpt;
+	char *argv[4];
+	char *buffer, *cmd, *pt;
+	char **env;
+	int ret;
+	size_t nenv;
+
+    if(!(cpt = cfgopt(copt, "VirusEvent")))
+	return;
+
+	/* Get an environment blcok copy */
+	if ((env = cl_copyenv(2)) == NULL) {
+		logg("!VirusAction: out of memory\n");
+		return;
+	}
+
+	for (nenv = 0; env[nenv]; ++nenv)
+		;
+
+	cmd = strdup(cpt->strarg);
+
+	if((pt = strstr(cmd, "%v"))) {
+		*pt = 0; pt += 2;
+	    buffer = (char *) mcalloc(strlen(cmd) + strlen(virname) + strlen(pt) + 1, sizeof(char));
+	    strcpy(buffer, cmd);
+	    strcat(buffer, virname);
+	    strcat(buffer, pt);
+	    free(cmd);
+	    cmd = buffer;
+	}
+	
+	/* Allocate env vars */
+	buffer = (char *) mcalloc(strlen(ENV_FILE) + strlen(filename) + 2, sizeof(char));
+	sprintf(buffer, "%s=%s", ENV_FILE, filename);
+	env[nenv++] = buffer;
+
+	buffer = (char *) mcalloc(strlen(ENV_VIRUS) + strlen(virname) + 2, sizeof(char));
+	sprintf(buffer, "%s=%s", ENV_VIRUS, virname);
+	env[nenv++] = buffer;
+    
+	/* spawn cmd /c & wait */
+	argv[0] = cl_getenv("COMSPEC");
+	argv[1] = "/c";
+	argv[2] = cmd;
+	argv[3] = NULL;
+
+	if (argv[0] == NULL) {
+		argv[0] = "cmd.exe";
+		ret = _spawnvp(_P_WAIT, argv[0], argv);
+	} else
+		ret = _spawnv(_P_WAIT, argv[0], argv);
+
+	if (ret == -1) {
+		mprintf("!Virusction: couldn't execute \"%s\" /c %s : %s\n", argv[0], argv[2], strerror(errno));
+	}
+	free(cmd);
+	cl_freeenv(env);
+}
+#else
+void virusaction(const char *filename, const char *virname, const struct cfgstruct *copt)
+{
 	pid_t pid;
 	struct cfgstruct *cpt;
 
@@ -91,14 +160,13 @@
 	cmd = strdup(cpt->strarg);
 
 	if((pt = strstr(cmd, "%v"))) {
-	    buffer = (char *) mcalloc(strlen(cmd) + strlen(virname) + 10, sizeof(char));
-	    *pt = 0; pt += 2;
+		*pt = 0; pt += 2;
+	    buffer = (char *) mcalloc(strlen(cmd) + strlen(virname) + strlen(pt) + 1, sizeof(char));
 	    strcpy(buffer, cmd);
 	    strcat(buffer, virname);
 	    strcat(buffer, pt);
 	    free(cmd);
-	    cmd = strdup(buffer);
-	    free(buffer);
+	    cmd = buffer;
 	}
 	
 	/* Allocate env vars.. to be portable env vars should not be freed */
@@ -125,6 +193,7 @@
 	logg("!VirusAction: fork failed.\n");
     }
 }
+#endif
 
 int poll_fd(int fd, int timeout_sec)
 {
@@ -154,9 +223,11 @@
 	fd_set rfds;
 	struct timeval tv;
 
+#ifndef C_WIN32
     if (fd >= DEFAULT_FD_SETSIZE) {
 	return -1;
     }
+#endif
 
     while (1) {
 	FD_ZERO(&rfds);
@@ -213,9 +284,11 @@
 	struct timeval tv;
 	char buff[1];
 
+#ifndef C_WIN32
     if (fd >= DEFAULT_FD_SETSIZE) {
         return 1;
     }
+#endif
 
     FD_ZERO(&rfds);
     FD_SET(fd, &rfds);
Index: clamd/thrmgr.h
===================================================================
--- clamd/thrmgr.h	(.../vendor/clamav/current)	(revision 845)
+++ clamd/thrmgr.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -20,7 +20,12 @@
 #define __THRMGR_H__
 
 #include <pthread.h>
+
+#ifdef C_WIN32
+#include <w32_time.h>
+#else
 #include <sys/time.h>
+#endif
 
 typedef struct work_item_tag {
 	struct work_item_tag *next;
Index: clamd/others.h
===================================================================
--- clamd/others.h	(.../vendor/clamav/current)	(revision 845)
+++ clamd/others.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -33,8 +33,14 @@
 
 #if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) && !defined(C_CYGWIN) && !defined(C_OS2) && !defined(INCOMPLETE_CMSG)
 int readsock(int sockfd, char *buf, size_t size);
+#elif defined(C_WIN32)
+#define readsock(sockfd, buf, size) recv(sockfd, buf, size, 0)
 #else
 #define	readsock	read
 #endif
 
+#if !defined(C_WIN32)
+#define closesocket close
 #endif
+
+#endif
Index: clamd/tcpserver.c
===================================================================
--- clamd/tcpserver.c	(.../vendor/clamav/current)	(revision 845)
+++ clamd/tcpserver.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,12 +23,18 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
+#include <clamav.h>
+#include <errno.h>
+
+#ifdef C_WIN32
+#include <windows.h>
+#include <io.h>
+#else
+#include <netdb.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <clamav.h>
-#include <errno.h>
-#include <netdb.h>
+#endif
 
 
 #include "options.h"
Index: clamd/server-th.c
===================================================================
--- clamd/server-th.c	(.../vendor/clamav/current)	(revision 845)
+++ clamd/server-th.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -28,8 +28,15 @@
 #include <string.h>
 #include <time.h>
 #include <sys/types.h>
+
+#ifdef C_WIN32
+#include <windows.h>
+#include <process.h>
+#include <io.h>
+#else
 #include <sys/socket.h>
 #include <unistd.h>
+#endif
 
 #include "server.h"
 #include "thrmgr.h"
@@ -42,7 +49,9 @@
 #include "output.h"
 
 #define BUFFSIZE 1024
+#undef FALSE
 #define FALSE (0)
+#undef TRUE
 #define TRUE (1)
 
 int progexit = 0;
@@ -65,14 +74,17 @@
 void scanner_thread(void *arg)
 {
 	client_conn_t *conn = (client_conn_t *) arg;
+#ifndef C_WIN32
 	sigset_t sigset;
+#endif
 	int ret, timeout, session=FALSE;
 	struct cfgstruct *cpt;
 
-
+#ifndef C_WIN32
     /* ignore all signals */
     sigfillset(&sigset);
     pthread_sigmask(SIG_SETMASK, &sigset, NULL);
+#endif
 
     if((cpt = cfgopt(conn->copt, "ReadTimeout"))) {
 	timeout = cpt->numarg;
@@ -93,7 +105,9 @@
 	    case COMMAND_SHUTDOWN:
 		pthread_mutex_lock(&exit_mutex);
 		progexit = 1;
+#ifndef C_WIN32
 		kill(conn->mainpid, SIGTERM);
+#endif
 		pthread_mutex_unlock(&exit_mutex);
 		break;
 
@@ -125,12 +139,25 @@
 	}
     } while (session);
 
-    close(conn->sd);
+    closesocket(conn->sd);
     cl_free(conn->root);
     free(conn);
     return;
 }
 
+#if defined(C_WIN32)
+BOOL WINAPI CtrlHandler(DWORD dwCtrlType)
+{
+	switch (dwCtrlType) 
+	{
+	case CTRL_C_EVENT:
+	case CTRL_BREAK_EVENT:
+		progexit = 1;
+		return TRUE;
+	}
+	return FALSE;
+}
+#else
 void sighandler_th(int sig)
 {
     switch(sig) {
@@ -156,6 +183,7 @@
 	    break; /* Take no action on other signals - e.g. SIGPIPE */
     }
 }
+#endif
 
 static struct cl_node *reload_db(struct cl_node *root, const struct cfgstruct *copt, int do_check)
 {
@@ -227,11 +255,13 @@
 	int new_sd, max_threads, stdopt;
 	unsigned int options = 0;
 	threadpool_t *thr_pool;
+#ifndef C_WIN32
 	struct sigaction sigact;
+	sigset_t sigset;
+#endif
 	mode_t old_umask;
 	struct cl_limits limits;
 	pthread_attr_t thattr;
-	sigset_t sigset;
 	client_conn_t *client_conn;
 	struct cfgstruct *cpt;
 #ifdef HAVE_STRERROR_R
@@ -251,7 +281,9 @@
 	pthread_attr_t clamuko_attr;
 	struct thrarg *tharg = NULL; /* shut up gcc */
 #endif
+#ifndef C_WIN32
 	memset(&sigact, 0, sizeof(struct sigaction));
+#endif
 
     /* save the PID */
     mainpid = getpid();
@@ -438,6 +470,9 @@
 	logg("Clamuko is not available.\n");
 #endif
 
+#if defined(C_WIN32)
+	SetConsoleCtrlHandler(CtrlHandler, TRUE);
+#else
     /* set up signal handling */
     sigfillset(&sigset);
     sigdelset(&sigset, SIGINT);
@@ -466,6 +501,7 @@
 	sigaddset(&sigact.sa_mask, SIGHUP);
 	sigaction(SIGSEGV, &sigact, NULL);
     }
+#endif
 
 #if defined(C_BIGSTACK) || defined(C_BSD)
     /*
@@ -495,8 +531,36 @@
 
     time(&start_time);
 
-    for(;;) {				
+    for(;;) {
+#ifdef C_WIN32
+	/* win32 can't interrupt accept on a signal, so poll with select */
+	fd_set rfds;
+	struct timeval tv;
+	int ret;
+
+    FD_ZERO(&rfds);
+    FD_SET(socketd, &rfds);
+    tv.tv_sec = 2;
+    tv.tv_usec = 0;
+	ret = select(0, &rfds, NULL, NULL, &tv);
+	if (ret == SOCKET_ERROR) {
+		logg("!select() failed\n");
+		continue;
+	}
+	if (ret > 0) {
+		new_sd = accept(socketd, NULL, NULL);
+		if (new_sd == -1) {
+			/* very bad - need to exit or restart */
+			logg("!accept() failed\n");
+			continue;
+		}
+	} else {
+		new_sd = -1;
+	}
+
+#else
 	new_sd = accept(socketd, NULL, NULL);
+
 	if((new_sd == -1) && (errno != EINTR)) {
 	    /* very bad - need to exit or restart */
 #ifdef HAVE_STRERROR_R
@@ -506,6 +570,7 @@
 #endif
 	    continue;
 	}
+#endif
 
 	if (sighup) {
 		logg("SIGHUP caught: re-opening log file.\n");
@@ -525,7 +590,7 @@
 		client_conn->limits = &limits;
 		client_conn->mainpid = mainpid;
 		if (!thrmgr_dispatch(thr_pool, client_conn)) {
-		    close(client_conn->sd);
+		    closesocket(client_conn->sd);
 		    free(client_conn);
 		    logg("!thread dispatch failed\n");
 		}
@@ -534,7 +599,7 @@
 	pthread_mutex_lock(&exit_mutex);
 	if(progexit) {
 	    if (new_sd >= 0) {
-		close(new_sd);
+		closesocket(new_sd);
 	    }
 	    pthread_mutex_unlock(&exit_mutex);
 	    break;
@@ -590,7 +655,7 @@
     logg("*Shutting down the main socket.\n");
     shutdown(socketd, 2);
     logg("*Closing the main socket.\n");
-    close(socketd);
+    closesocket(socketd);
 
 #ifndef C_OS2
     if((cpt = cfgopt(copt, "LocalSocket"))) {
Index: clamd/clamd.c
===================================================================
--- clamd/clamd.c	(.../vendor/clamav/current)	(revision 845)
+++ clamd/clamd.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,15 +23,24 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
-#include <sys/time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <time.h>
+#include <clamav.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#include <tchar.h>
+#include <windows.h>
+#include "w32_service.h"
+extern w32_service g_service;
+#else
+#include <unistd.h>
+#include <sys/time.h>
 #include <pwd.h>
 #include <grp.h>
-#include <clamav.h>
+#endif
 
 #if defined(USE_SYSLOG) && !defined(C_AIX)
 #include <syslog.h>
@@ -64,16 +73,39 @@
 void clamd(struct optstruct *opt)
 {
 	struct cfgstruct *copt, *cpt;
+#if !defined(C_WIN32)
         struct passwd *user;
+#endif
 	time_t currtime;
 	struct cl_node *root = NULL;
 	const char *dbdir, *cfgfile;
+	char *cfgfile_t = NULL;
 	int ret, tcpsock;
 	unsigned int virnum = 0;
 #ifdef C_LINUX
 	struct stat sb;
 #endif
 
+#if defined(C_WIN32)
+	WSADATA wsa;
+
+	ZeroMemory(&wsa, sizeof(wsa));
+	ret = WSAStartup(MAKEWORD(1, 1), &wsa);
+	if (ret != 0) {
+		fprintf(stderr, "ERROR: WSAStartup failed with %d\n", ret);
+		exit(1);
+	}
+
+	if (optl(opt, "install")) {
+		w32_service_install(&g_service);
+		exit(1);
+	}
+	if (optl(opt, "uninstall")) {
+		w32_service_uninstall(&g_service);
+		exit(1);
+	}
+#endif
+
     /* initialize some important variables */
 
     if(optc(opt, 'V')) {
@@ -99,15 +131,23 @@
     }
 
     /* parse the config file */
-    if(optc(opt, 'c'))
-	cfgfile = getargc(opt, 'c');
-    else
-	cfgfile = CL_DEFAULT_CFG;
+	if(optc(opt, 'c'))
+		cfgfile = getargc(opt, 'c');
+	else {
+		cfgfile_t = cl_retconfpath("clamd.conf");
+		if (!cfgfile_t) {
+			fprintf(stderr, "ERROR: out of memory\n");
+			exit(1);
+		}
+		cfgfile = cfgfile_t;
+	}
 
     if((copt = parsecfg(cfgfile, 1)) == NULL) {
 	fprintf(stderr, "ERROR: Can't open/parse the config file %s\n", cfgfile);
+	free(cfgfile_t);
 	exit(1);
     }
+	free(cfgfile_t);
 
     umask(0);
 
@@ -137,7 +177,11 @@
 
     if((cpt = cfgopt(copt, "LogFile"))) {
 	logg_file = cpt->strarg;
+#ifdef C_WIN32
 	if(strlen(logg_file) < 2 || (logg_file[0] != '/' && logg_file[0] != '\\' && logg_file[1] != ':')) {
+#else
+	if(strlen(logg_file) < 2 || logg_file[0] != '/') {
+#endif
 	    fprintf(stderr, "ERROR: LogFile requires full path.\n");
 	    exit(1);
 	}
@@ -196,6 +240,11 @@
     } else if(cfgopt(copt, "TCPSocket")) {
 	tcpsock = 1;
     } else if(cfgopt(copt, "LocalSocket")) {
+#ifdef C_WIN32
+		fprintf(stderr, "ERROR: LocalSocket is not supported under Win32\n");
+		logg("!LocalSocket is not supported under Win32\n");
+		exit(1);
+#endif
 	tcpsock = 0;
     } else {
 	fprintf(stderr, "ERROR: You must select server type (local/tcp).\n");
@@ -204,7 +253,7 @@
     }
 
     /* drop privileges */
-#ifndef C_OS2
+#if !defined(C_OS2) && !defined(C_WIN32)
     if(geteuid() == 0 && (cpt = cfgopt(copt, "User"))) {
 	if((user = getpwnam(cpt->strarg)) == NULL) {
 	    fprintf(stderr, "ERROR: Can't get information about user %s.\n", cpt->strarg);
@@ -286,10 +335,14 @@
     if(!cfgopt(copt, "Foreground"))
 	daemonize();
 
+#ifdef C_WIN32
+	ret = tcpserver(opt, copt, root);
+#else
     if(tcpsock)
 	ret = tcpserver(opt, copt, root);
     else
 	ret = localserver(opt, copt, root);
+#endif
 
     printf("server ended; result=%d\n", ret);
     logg_close();
@@ -308,19 +361,25 @@
     printf("    --help                   -h             Show this help.\n");
     printf("    --version                -V             Show version number.\n");
     printf("    --debug                                 Enable debug mode.\n");
-    printf("    --config-file=FILE       -c FILE        Read configuration from FILE.\n\n");
-
+    printf("    --config-file=FILE       -c FILE        Read configuration from FILE.\n");
+#ifdef C_WIN32
+	printf("    --install                               Install windows service.\n");
+	printf("    --uninstall                             Uninstall windows service.\n");
+#endif
+	printf("\n");
     exit(0);
 }
 
 void daemonize(void)
 {
-	int i;
+#if defined(C_WIN32)
+	g_service.update_scm(&g_service, SERVICE_RUNNING, 0, 1000);
+	return;
 
-
-#ifdef C_OS2
-    return;
+#elif defined(C_OS2) 
+	return;
 #else
+	int i;
 
     if((i = open("/dev/null", O_WRONLY)) == -1) {
 	logg("!Cannot open /dev/null. Only use Debug if Foreground is enabled.\n");
Index: clamd/session.c
===================================================================
--- clamd/session.c	(.../vendor/clamav/current)	(revision 845)
+++ clamd/session.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,15 +23,22 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
 #include <pthread.h>
 #include <time.h>
 #include <signal.h>
 #include <errno.h>
 
+#ifdef C_WIN32
+#include <windows.h>
+#include <io.h>
+#else
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#endif
+
+
 #include "cfgparser.h"
 #include "others.h"
 #include "defaults.h"
@@ -121,7 +128,7 @@
 	    return COMMAND_SHUTDOWN;
 	}
 
-	sprintf(path, "%s/daily.cvd", dbdir);
+	sprintf(path, "%s" PATH_SEPARATOR "daily.cvd", dbdir);
 
 	if((daily = cl_cvdhead(path))) {
 		time_t t = (time_t) daily->stime;
Index: clamd/scanner.c
===================================================================
--- clamd/scanner.c	(.../vendor/clamav/current)	(revision 845)
+++ clamd/scanner.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,19 +23,27 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <clamav.h>
+#include <pthread.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#include <direct.h>
+#include <w32_dirent.h>
+#include <windows.h>
+#else
+#include <unistd.h>
+#include <sys/param.h>
 #include <sys/time.h>
 #include <sys/wait.h>
-#include <sys/param.h>
 #include <dirent.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-#include <clamav.h>
-#include <pthread.h>
+#endif
 
 #if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
 #include <limits.h>
@@ -135,7 +143,7 @@
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
 		    /* build the full name */
 		    fname = (char *) mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
-		    sprintf(fname, "%s/%s", dirname, dent->d_name);
+		    sprintf(fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if(lstat(fname, &statbuf) != -1) {
@@ -218,10 +226,12 @@
     }
 
     switch(sb.st_mode & S_IFMT) {
+#ifndef C_WIN32
 	case S_IFLNK:
 	    if(!cfgopt(copt, "FollowFileSymlinks"))
 		break;
 	    /* else go to the next case */
+#endif
 	case S_IFREG: 
 	    if(sb.st_size == 0) { /* empty file */
 		mdprintf(odesc, "%s: Empty file\n", filename);
@@ -360,7 +370,7 @@
 	    continue;
 
 	if(bind(sockfd, (struct sockaddr *) &server, sizeof(struct sockaddr_in)) == -1)
-	    close(sockfd);
+	    closesocket(sockfd);
 	else
 	    bound = 1;
     }
@@ -376,7 +386,7 @@
     if(!bound && !portscan) {
 	logg("!ScanStream: Can't find any free port.\n");
 	mdprintf(odesc, "Can't find any free port. ERROR\n");
-	close(sockfd);
+	closesocket(sockfd);
 	return -1;
     } else {
 	listen(sockfd, 1);
@@ -387,17 +397,17 @@
 	case 0: /* timeout */
 	    mdprintf(odesc, "Accept timeout. ERROR\n");
 	    logg("!ScanStream: accept timeout.\n");
-	    close(sockfd);
+	    closesocket(sockfd);
 	    return -1;
 	case -1:
 	    mdprintf(odesc, "Accept poll. ERROR\n");
 	    logg("!ScanStream: accept poll failed.\n");
-	    close(sockfd);
+	    closesocket(sockfd);
 	    return -1;
     }
 
     if((acceptd = accept(sockfd, NULL, NULL)) == -1) {
-	close(sockfd);
+	closesocket(sockfd);
 	mdprintf(odesc, "accept() ERROR\n");
 	logg("!ScanStream: accept() failed.\n");
 	return -1;
@@ -405,10 +415,10 @@
 
     logg("*Accepted connection on port %d, fd %d\n", port, acceptd);
 
-    if((tmp = tmpfile()) == NULL) {
+    if((tmp = cli_tmpfile()) == NULL) {
 	shutdown(sockfd, 2);
-	close(sockfd);
-	close(acceptd);
+	closesocket(sockfd);
+	closesocket(acceptd);
 	mdprintf(odesc, "tempfile() failed. ERROR\n");
 	logg("!ScanStream: Can't create temporary file.\n");
 	return -1;
@@ -424,15 +434,15 @@
     btread = sizeof(buff);
 
     while((retval = poll_fd(acceptd, timeout)) == 1) {
-	bread = read(acceptd, buff, btread);
+	bread = recv(acceptd, buff, btread, 0);
 	if(bread <= 0)
 	    break;
 	size += bread;
 
 	if(writen(tmpd, buff, bread) != bread) {
 	    shutdown(sockfd, 2);
-	    close(sockfd);
-	    close(acceptd);
+	    closesocket(sockfd);
+	    closesocket(acceptd);
 	    mdprintf(odesc, "Temporary file -> write ERROR\n");
 	    logg("!ScanStream: Can't write to temporary file.\n");
 	    if(tmp)
@@ -467,8 +477,8 @@
     if(tmp)
 	fclose(tmp);
 
-    close(acceptd);
-    close(sockfd);
+    closesocket(acceptd);
+    closesocket(sockfd);
 
     if(ret == CL_VIRUS) {
 	mdprintf(odesc, "stream: %s FOUND\n", virname);
Index: clamd/options.c
===================================================================
--- clamd/options.c	(.../vendor/clamav/current)	(revision 845)
+++ clamd/options.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -33,6 +33,16 @@
 #include <sys/resource.h>
 #endif
 
+#ifdef C_WIN32
+#include <tchar.h>
+#include <windows.h>
+#include "w32_service.h"
+#endif
+
+#if defined(_MSC_VER) && defined(_DEBUG) && defined(C_WIN32)
+#include <crtdbg.h>
+#endif
+
 #include "options.h"
 #include "others.h"
 #include "../libclamav/others.h"
@@ -40,7 +50,11 @@
 
 void clamd(struct optstruct *opt);
 
+#ifdef C_WIN32
+int normal_main(int argc, char **argv)
+#else
 int main(int argc, char **argv)
+#endif
 {
 	int ret, opt_index, i, len;
 	struct optstruct *opt;
@@ -52,6 +66,10 @@
 	    {"config-file", 1, 0, 'c'},
 	    {"version", 0, 0, 'V'},
 	    {"debug", 0, 0, 0},
+#ifdef C_WIN32
+		{"install", 0, 0, 0},
+		{"uninstall", 0, 0, 0},
+#endif
 	    {0, 0, 0, 0}
     	};
 
@@ -119,6 +137,53 @@
     return(0);
 }
 
+#ifdef C_WIN32
+
+extern int progexit;
+w32_service g_service;
+
+static int w32_service_main(w32_service *s, DWORD argc, LPTSTR *argv)
+{
+#if defined(_MSC_VER) && defined(_DEBUG)
+	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
+/*	_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
+	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+	_CrtSetBreakAlloc(127847);
+*/
+#endif
+	return normal_main(argc, argv);
+}
+
+static void w32_service_stop(w32_service *s)
+{
+	s->update_scm(s, SERVICE_STOP_PENDING, 0, 60000);
+	progexit = 1;
+}
+
+int main(int argc, char **argv)
+{
+	int i;
+
+	if (!w32_service_create(&g_service)) {
+		fprintf(stderr, "Failed to create a win32 service object\n");
+		return 56;
+	}
+	g_service.name = _T("clamd");
+	g_service.display_name = _T("Clam AntiVirus Scanner Service");
+	g_service.description = _T("Provides virus scanning services for the local machine.");
+	g_service.main = w32_service_main;
+	g_service.stop = w32_service_stop;
+
+	for (i = 1; i < argc; ++i) {
+		if (strcasecmp(argv[i], "--service") == 0) {
+			w32_services_start();
+			return 0;
+		}
+	}
+	return normal_main((int)argc, argv);
+}
+#endif
+
 void register_char_option(struct optstruct *opt, char ch)
 {
 	struct optnode *newnode;
Index: libclamav/others.c
===================================================================
--- libclamav/others.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/others.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -26,24 +26,36 @@
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <dirent.h>
 #include <time.h>
 #include <fcntl.h>
-#include <pwd.h>
 #include <errno.h>
 #include <target.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#include <share.h>
+#include <process.h>
+#include <direct.h>
+#include "w32_dirent.h"
+#include <windows.h>
+#else
+#include <sys/wait.h>
 #include <sys/time.h>
 #include <sys/param.h>
+#include <pwd.h>
+#include <unistd.h>
+#include <dirent.h>
+#endif
 
 #ifdef CL_THREAD_SAFE
 #  include <pthread.h>
 pthread_mutex_t cli_gentemp_mutex = PTHREAD_MUTEX_INITIALIZER;
+#ifdef C_WIN32
+pthread_mutex_t cl_env_mutex = PTHREAD_MUTEX_INITIALIZER;
 #endif
+#endif
 
 #if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
 #include <limits.h>
@@ -358,16 +370,94 @@
     } else return alloc;
 }
 
-unsigned int cli_rndnum(unsigned int max)
+#ifdef C_WIN32
+char **cl_copyenv(size_t extra)
 {
-    struct timeval tv;
+	char **env;
+	size_t nenv, i;
 
-  gettimeofday(&tv, (struct timezone *) 0);
-  srand(tv.tv_usec+clock());
+#ifdef CL_THREAD_SAFE
+	pthread_mutex_lock(&cl_env_mutex);
+#endif
 
-  return rand() % max;
+	for (nenv = 0; _environ[nenv]; ++nenv)
+		;
+	env = malloc(sizeof(char *) * (1 + nenv + extra));
+	if (env == NULL)
+		return NULL;
+
+	for (nenv = 0; _environ[nenv]; ++env) {
+		env[nenv] = strdup(_environ[nenv]);
+		if (env[nenv] == NULL) {
+			for (; nenv > 0; --nenv)
+				free(env[nenv - 1]);
+			free(env);
+			return NULL;
+		}
+	}
+	for (i = 0; i < extra + 1; ++i)
+		env[nenv++] = NULL;
+
+#ifdef CL_THREAD_SAFE
+	pthread_mutex_unlock(&cl_env_mutex);
+#endif
+	return env;
 }
 
+void cl_freeenv(char **env)
+{
+	size_t i;
+
+	if (env) {
+		for (i = 0; env[i]; ++i)
+			free(env[i]);
+		free(env);
+	}
+}
+#endif
+
+#ifdef C_WIN32
+char *cl_getenv(const char *var)
+{
+	char *ret;
+
+#ifdef CL_THREAD_SAFE
+	pthread_mutex_lock(&cl_env_mutex);
+#endif
+	ret = getenv(var);
+#ifdef CL_THREAD_SAFE
+	pthread_mutex_unlock(&cl_env_mutex);
+#endif
+	return ret;
+}
+#else
+char *cl_getenv(const char *var)
+{
+	return getenv(var);
+}
+#endif
+
+#ifdef C_WIN32
+int cl_putenv(const char *var)
+{
+	int ret;
+
+#ifdef CL_THREAD_SAFE
+	pthread_mutex_lock(&cl_env_mutex);
+#endif
+	ret = putenv(var);
+#ifdef CL_THREAD_SAFE
+	pthread_mutex_unlock(&cl_env_mutex);
+#endif
+	return ret;
+}
+#else
+int cl_putenv(const char *var)
+{
+	return putenv(var);
+}
+#endif
+
 void cl_settempdir(const char *dir, short leavetemps)
 {
 	char *var;
@@ -375,17 +465,90 @@
     if(dir) {
 	var = (char *) cli_malloc(8 + strlen(dir));
 	sprintf(var, "TMPDIR=%s", dir);
-	if(!putenv(var))
+	if(!cl_putenv(var))
 	    cli_dbgmsg("Setting %s as global temporary directory\n", dir);
 	else
 	    cli_warnmsg("Can't set TMPDIR variable - insufficient space in the environment.\n");
 
 	/* WARNING: var must not be released - see putenv(3) */
+#ifdef C_WIN32
+	/* OK under win32, and bad form for a DLL to leak memory */
+		free(var);
+#endif
     }
 
     cli_leavetemps_flag = leavetemps;
 }
 
+const char *cl_gettempdir()
+{
+	int i;
+	const char *tmpdir;
+#if defined(CYGWIN) || defined(C_WIN32)
+	const char *order[] = { "TEMP", "TMP", "TMPDIR" };
+#else
+	const char *order[] = { "TMPDIR", "TMP", "TEMP" };
+#endif
+
+#if defined(C_WIN32)
+	static char w32_temp[MAX_PATH];
+#endif
+
+	for (i = 0; i < sizeof(order)/sizeof(order[0]); ++i) {
+		if ( (tmpdir = cl_getenv(order[i])) != NULL )
+			return tmpdir;
+	}
+
+#if !defined(C_WIN32)
+#ifdef P_tmpdir
+	    return P_tmpdir;
+#else
+	    retunr "/tmp";
+#endif
+#else
+	/* try windows system temp dir */
+	if (w32_temp[0] == '\0') {
+#ifdef CL_THREAD_SAFE
+		pthread_mutex_lock(&cli_gentemp_mutex);
+#endif
+		if (w32_temp[0] == '\0') {
+			if (!GetTempPathA(MAX_PATH, w32_temp)) {
+				cli_dbgmsg("cli_gentemp('%s'): GetTempPath failed with %lu\n", w32_temp, GetLastError());
+				return NULL;
+			}
+		}
+#ifdef CL_THREAD_SAFE
+		pthread_mutex_unlock(&cli_gentemp_mutex);
+#endif
+	}
+	return w32_temp;
+#endif
+}
+
+#ifdef C_WIN32
+unsigned int cli_rndnum(unsigned int max)
+{
+	LARGE_INTEGER count;
+	if (QueryPerformanceCounter(&count)) {
+		srand(clock() + count.LowPart);
+	} else {
+		srand(clock());
+	}
+	return rand() % max;
+}
+
+#else
+unsigned int cli_rndnum(unsigned int max)
+{
+    struct timeval tv;
+
+  gettimeofday(&tv, (struct timezone *) 0);
+  srand(tv.tv_usec+clock());
+
+  return rand() % max;
+}
+#endif
+
 char *cli_gentemp(const char *dir)
 {
 	char *name, *tmp;
@@ -396,14 +559,9 @@
 
 
     if(!dir) {
-	if((mdir = getenv("TMPDIR")) == NULL)
-#ifdef P_tmpdir
-	    mdir = P_tmpdir;
-#else
-	    mdir = "/tmp";
-#endif
+		mdir = cl_gettempdir();
     } else
-	mdir = dir;
+		mdir = dir;
 
     name = (char*) cli_calloc(strlen(mdir) + 1 + 16 + 1 + 7, sizeof(char));
     if(name == NULL) {
@@ -422,7 +580,7 @@
 	    salt[i] = cli_rndnum(255);
 
 	tmp = cli_md5buff(( char* ) salt, 48);
-	sprintf(name, "%s/clamav-", mdir);
+	sprintf(name, "%s" PATH_SEPARATOR "clamav-", mdir);
 	strncat(name, tmp, 16);
 	free(tmp);
     } while(stat(name, &foo) != -1);
@@ -434,10 +592,142 @@
     return(name);
 }
 
+#ifdef C_WIN32
+/*
+ From GNU-win32.  Looks a bit odd as Win32 is case-insenstive, might
+ want to fix this at some point
+*/
+static int mkstemp_(char *path, int mode)
+{
+	register char *start, *trv;
+	struct stat sbuf;
+	int rval;
+	char *alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+	for (trv = path; *trv; ++trv)
+		;
+	--trv;
+	while (trv >= path && *trv == 'X') {
+		*trv-- = alphabet[cli_rndnum(26+10)];
+	}
+	start = trv + 1;
+
+	/*
+	 * check the target directory; if you have six X's and it
+	 * doesn't exist this runs for a *very* long time.
+	 */
+
+	for (;; --trv) {
+		if (trv <= path)
+			break;
+		if (*trv == '/' || *trv == '\\') {
+			char sv = *trv;
+			*trv = '\0';
+			rval = stat(path, &sbuf);
+			*trv = sv;
+			if (rval != 0)
+				return(0);
+			if (!S_ISDIR(sbuf.st_mode)) {
+				errno = ENOTDIR;
+				return(0);
+			}
+			break;
+		}
+	}
+
+	for (;;) {
+		rval = _sopen(path, O_CREAT|O_EXCL|mode, _SH_DENYRW, S_IREAD|S_IWRITE);
+		if (rval != -1)
+			return rval;
+		if (errno != EEXIST) {
+			close(rval);
+			return -1;
+		}
+
+		/* tricky little algorithm for backward compatibility */
+		for (trv = start; *trv;) {
+			*trv++ = alphabet[cli_rndnum(26+10)];
+		}
+	}
+	/*NOTREACHED*/
+}
+
+/** From GNU-win32 */
+int cli_mkstemp(char *path)
+{
+	return mkstemp_(path, _O_BINARY|_O_RDWR);
+}
+
+/** MSVC's tmpfile puts everything in the root directory (!) */
+FILE *cli_tmpfile()
+{
+	FILE *f;
+	int fd;
+	char path[MAX_PATH];
+
+	snprintf(path, MAX_PATH, "%s" PATH_SEPARATOR "clamavtmpXXXXXX", cl_gettempdir());
+	fd = mkstemp_(path, _O_BINARY|_O_RDWR|_O_TEMPORARY);
+	if (fd == -1)
+		return NULL;
+
+	f = fdopen(fd, "wb+");
+	if (!f)
+		close(fd);
+	return f;
+}
+
+#endif
+
+#ifdef C_WIN32
 int cli_rmdirs(const char *dirname)
 {
 	DIR *dd;
 	struct dirent *dent;
+	struct stat maind, statbuf;
+	char *fname;
+
+	while(stat(dirname, &maind) != -1) {
+		if(!rmdir(dirname)) break;
+
+		if((dd = opendir(dirname)) != NULL) {
+			while((dent = readdir(dd))) {
+				if(dent->d_ino)
+				{
+					if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
+						fname = cli_calloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
+						sprintf(fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
+
+						/* stat the file */
+						if(lstat(fname, &statbuf) != -1) {
+							if(S_ISDIR(statbuf.st_mode) && !S_ISLNK(statbuf.st_mode)) {
+								if(rmdir(fname) == -1) { /* can't be deleted */
+									if(errno == EACCES) {
+										cli_errmsg("Can't remove some temporary directories due to access problem.\n");
+										closedir(dd);
+										free(fname);
+										return 0;
+									}
+								cli_rmdirs(fname);
+							}
+						} else
+							unlink(fname);
+						}
+						free(fname);
+					}
+				}
+			}
+			closedir(dd);
+		} else { 
+			return 53;
+		}
+    }
+    return 0;
+}
+#else
+int cli_rmdirs(const char *dirname)
+{
+	DIR *dd;
+	struct dirent *dent;
 #if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
 	union {
 	    struct dirent d;
@@ -447,7 +737,6 @@
 	struct stat maind, statbuf;
 	char *fname;
 
-
     chmod(dirname, 0700);
     if((dd = opendir(dirname)) != NULL) {
 	while(stat(dirname, &maind) != -1) {
@@ -471,7 +760,7 @@
 		{
 		    if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
 			fname = cli_calloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
-			sprintf(fname, "%s/%s", dirname, dent->d_name);
+			sprintf(fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 			/* stat the file */
 			if(lstat(fname, &statbuf) != -1) {
@@ -505,6 +794,7 @@
     closedir(dd);
     return 0;
 }
+#endif
 
 /* Function: readn
         Try hard to read the requested number of bytes
@@ -597,10 +887,14 @@
 	int s, d, bytes;
 
 
-    if((s = open(src, O_RDONLY)) == -1)
+    if((s = open(src, O_BINARY|O_RDONLY)) == -1)
 	return -1;
 
-    if((d = open(dest, O_CREAT|O_WRONLY|O_TRUNC|O_BINARY)) == -1) {
+#ifdef C_WIN32
+    if((d = open(dest, O_CREAT|O_WRONLY|O_TRUNC|O_BINARY, S_IWRITE)) == -1) {
+#else
+    if((d = open(dest, O_CREAT|O_WRONLY|O_TRUNC|O_BINARY, 0644)) == -1) {
+#endif
 	close(s);
 	return -1;
     }
Index: libclamav/chmunpack.c
===================================================================
--- libclamav/chmunpack.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/chmunpack.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -26,9 +26,14 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <string.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
 #if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK)
 #if HAVE_MMAP
 #if HAVE_SYS_MMAN_H
@@ -488,12 +493,12 @@
                 	        return FALSE;
                 	}
 		} else {
-			file_e->name = (unsigned char *) cli_malloc(name_len+1);
+			file_e->name = (unsigned char *) cli_malloc((size_t)(name_len+1));
 			if (!file_e->name) {
 				free(file_e);
 				return FALSE;
 			}
-			strncpy((char *) file_e->name, (char *) current, name_len);
+			strncpy((char *) file_e->name, (char *) current, (size_t)name_len);
 			file_e->name[name_len] = '\0';
 		}
 		current += name_len;
@@ -875,6 +880,7 @@
 	mf_out.fh = fdopen(mf_out.desc, "w");
 	if (!mf_out.fh) {
 		cli_dbgmsg("fdopen failed\n", filename);
+		close(mf_out.desc);
 		free(mf_in.name);
 		fclose(mf_in.fh);
 		return FALSE;
Index: libclamav/others.h
===================================================================
--- libclamav/others.h	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/others.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -60,4 +60,11 @@
 int cli_bitset_set(bitset_t *bs, unsigned long bit_offset);
 int cli_bitset_test(bitset_t *bs, unsigned long bit_offset);
 
+#ifdef C_WIN32
+int cli_mkstemp(char *path);
+FILE *cli_tmpfile();
+#else
+#define cli_tmpfile tmpfile
 #endif
+
+#endif
Index: libclamav/text.c
===================================================================
--- libclamav/text.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/text.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -61,8 +61,10 @@
 #endif
 
 #ifndef	CL_DEBUG
+#ifndef NDEBUG
 #define	NDEBUG	/* map CLAMAV debug onto standard */
 #endif
+#endif
 
 #include <stdlib.h>
 #ifdef	C_DARWIN
Index: libclamav/message.c
===================================================================
--- libclamav/message.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/message.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -22,8 +22,10 @@
 #endif
 
 #ifndef	CL_DEBUG
+#ifndef NDEBUG
 #define	NDEBUG	/* map CLAMAV debug onto standard */
 #endif
+#endif
 
 #ifdef CL_THREAD_SAFE
 #ifndef	_REENTRANT
@@ -36,11 +38,14 @@
 #endif
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
 
+#ifndef C_WIN32
+#include <strings.h>
+#endif
+
 #ifdef	CL_THREAD_SAFE
 #include <pthread.h>
 #endif
@@ -222,7 +227,7 @@
 	cli_dbgmsg("messageSetMimeType: '%s'\n", type);
 
 	/* Ignore leading spaces */
-	while(!isalpha(*type))
+	while(!isalpha((unsigned char)*type))
 		if(*type++ == '\0')
 			return 0;
 
@@ -357,7 +362,7 @@
 	 * that something is wrong if we get that - maybe we should force a
 	 * scan of this part
 	 */
-	while(*disptype && isspace((int)*disptype))
+	while(*disptype && isspace((unsigned char)*disptype))
 		disptype++;
 
 	if(*disptype) {
@@ -391,7 +396,7 @@
 	if(arg == NULL)
 		return;	/* Note: this is not an error condition */
 
-	while(isspace(*arg))
+	while(isspace((unsigned char)*arg))
 		arg++;
 
 	if(*arg == '\0')
@@ -453,7 +458,7 @@
 		const char *key, *cptr;
 		char *data, *field;
 
-		if(isspace(*string) || (*string == ';')) {
+		if(isspace((unsigned char)*string) || (*string == ';')) {
 			string++;
 			continue;
 		}
@@ -495,7 +500,7 @@
 		 *		or tspecials>
 		 * But too many MUAs ignore this
 		 */
-		while(isspace(*string) && (*string != '\0'))
+		while(isspace((unsigned char)*string) && (*string != '\0'))
 			string++;
 
 		cptr = string++;
@@ -576,7 +581,7 @@
 			 * The field is not in quotes, so look for the closing
 			 * white space
 			 */
-			while((*string != '\0') && !isspace(*string))
+			while((*string != '\0') && !isspace((unsigned char)*string))
 				string++;
 
 			len = (size_t)string - (size_t)key + 1;
@@ -631,7 +636,7 @@
 #endif
 		if(strncasecmp(ptr, variable, len) == 0) {
 			ptr = &ptr[len];
-			while(isspace(*ptr))
+			while(isspace((unsigned char)*ptr))
 				ptr++;
 			if(*ptr != '=') {
 				cli_warnmsg("messageFindArgument: no '=' sign found in MIME header\n");
@@ -700,9 +705,9 @@
 
 		for(e = encoding_map; e->string; e++) {
 			int sim;
-			const char lowertype = tolower(type[0]);
+			const char lowertype = tolower((unsigned char)type[0]);
 
-			if((lowertype != tolower(e->string[0])) && (lowertype != 'x'))
+			if((lowertype != tolower((unsigned char)e->string[0])) && (lowertype != 'x'))
 				/*
 				 * simil is expensive, I'm yet to encounter only
 				 * one example of a missent encoding when the
@@ -834,7 +839,7 @@
 			const char *p;
 
 			for(p = data; *p; p++)
-				if(!isspace(*p)) {
+				if(!isspace((unsigned char)*p)) {
 					iswhite = 0;
 					break;
 				}
@@ -2032,15 +2037,15 @@
 		char *p1;
 		char c = *s;
 
-		if(isupper(c))
+		if(isupper((unsigned char)c))
 			continue;
-		if(isdigit(c))
+		if(isdigit((unsigned char)c))
 			continue;
 		if(c == '+')
 			continue;
 		if(c == '/')
 			continue;
-		if(islower(c))
+		if(islower((unsigned char)c))
 			continue;
 
 		for(p1 = s; p1[0] != '\0'; p1++)
@@ -2216,7 +2221,7 @@
 static unsigned char
 hex(char c)
 {
-	if(isdigit(c))
+	if(isdigit((unsigned char)c))
 		return c - '0';
 	if((c >= 'A') && (c <= 'F'))
 		return c - 'A' + 10;
@@ -2247,13 +2252,13 @@
 static unsigned char
 base64(char c)
 {
-	if(isupper(c))
+	if(isupper((unsigned char)c))
 		return c - 'A';
-	if(isdigit(c))
+	if(isdigit((unsigned char)c))
 		return c - '0' + 52;
 	if(c == '+')
 		return 62;
-	if(islower(c))	/* call last, most base64 is upper case */
+	if(islower((unsigned char)c))	/* call last, most base64 is upper case */
 		return c - 'a' + 26;
 
 	if(c != '/')
@@ -2564,7 +2569,7 @@
 
 		if(s1 < end1) {
 			while(s1 < end1 && s2 < end2) {
-				if(tolower(*s1) == tolower(*s2)) {
+				if(tolower((unsigned char)*s1) == tolower((unsigned char)*s2)) {
 					some_similarity = TRUE;
 					cs1 = s1;
 					cs2 = s2;
@@ -2577,7 +2582,7 @@
 							s2++;
 							common++;
 						}
-					while(tolower(*s1) == tolower(*s2));
+					while(tolower((unsigned char)*s1) == tolower((unsigned char)*s2));
 
 					if(common > maxchars) {
 						diff = common - maxchars;
@@ -2646,6 +2651,6 @@
 		return 0;
 
 	return (strncasecmp(line, "begin ", 6) == 0) &&
-		isdigit(line[6]) && isdigit(line[7]) &&
-		isdigit(line[8]) && (line[9] == ' ');
+		isdigit((unsigned char)line[6]) && isdigit((unsigned char)line[7]) &&
+		isdigit((unsigned char)line[8]) && (line[9] == ' ');
 }
Index: libclamav/md5.c
===================================================================
--- libclamav/md5.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/md5.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -241,33 +241,33 @@
 	memset(&ctx->buffer[used], 0, free - 8);
 
 	ctx->lo <<= 3;
-	ctx->buffer[56] = ctx->lo;
-	ctx->buffer[57] = ctx->lo >> 8;
-	ctx->buffer[58] = ctx->lo >> 16;
-	ctx->buffer[59] = ctx->lo >> 24;
-	ctx->buffer[60] = ctx->hi;
-	ctx->buffer[61] = ctx->hi >> 8;
-	ctx->buffer[62] = ctx->hi >> 16;
-	ctx->buffer[63] = ctx->hi >> 24;
+	ctx->buffer[56] = (unsigned char)ctx->lo;
+	ctx->buffer[57] = (unsigned char)(ctx->lo >> 8);
+	ctx->buffer[58] = (unsigned char)(ctx->lo >> 16);
+	ctx->buffer[59] = (unsigned char)(ctx->lo >> 24);
+	ctx->buffer[60] = (unsigned char)ctx->hi;
+	ctx->buffer[61] = (unsigned char)(ctx->hi >> 8);
+	ctx->buffer[62] = (unsigned char)(ctx->hi >> 16);
+	ctx->buffer[63] = (unsigned char)(ctx->hi >> 24);
 
 	body(ctx, ctx->buffer, 64);
 
-	result[0] = ctx->a;
-	result[1] = ctx->a >> 8;
-	result[2] = ctx->a >> 16;
-	result[3] = ctx->a >> 24;
-	result[4] = ctx->b;
-	result[5] = ctx->b >> 8;
-	result[6] = ctx->b >> 16;
-	result[7] = ctx->b >> 24;
-	result[8] = ctx->c;
-	result[9] = ctx->c >> 8;
-	result[10] = ctx->c >> 16;
-	result[11] = ctx->c >> 24;
-	result[12] = ctx->d;
-	result[13] = ctx->d >> 8;
-	result[14] = ctx->d >> 16;
-	result[15] = ctx->d >> 24;
+	result[0] = (unsigned char)ctx->a;
+	result[1] = (unsigned char)(ctx->a >> 8);
+	result[2] = (unsigned char)(ctx->a >> 16);
+	result[3] = (unsigned char)(ctx->a >> 24);
+	result[4] = (unsigned char)ctx->b;
+	result[5] = (unsigned char)(ctx->b >> 8);
+	result[6] = (unsigned char)(ctx->b >> 16);
+	result[7] = (unsigned char)(ctx->b >> 24);
+	result[8] = (unsigned char)(ctx->c);
+	result[9] = (unsigned char)(ctx->c >> 8);
+	result[10] = (unsigned char)(ctx->c >> 16);
+	result[11] = (unsigned char)(ctx->c >> 24);
+	result[12] = (unsigned char)(ctx->d);
+	result[13] = (unsigned char)(ctx->d >> 8);
+	result[14] = (unsigned char)(ctx->d >> 16);
+	result[15] = (unsigned char)(ctx->d >> 24);
 
 	memset(ctx, 0, sizeof(*ctx));
 }
Index: libclamav/dsig.c
===================================================================
--- libclamav/dsig.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/dsig.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -90,7 +90,7 @@
 
     for(i = plainlen - 1; i >= 0; i--) { /* reverse */
 	mpz_tdiv_qr_ui(p, r, p, 256);
-	decoded[i] = mpz_get_ui(r);
+	decoded[i] = (char)mpz_get_ui(r);
     }
 
     mpz_clear(p);
@@ -104,7 +104,7 @@
 	mpz_t n, e;
 	char *pt, *pt2;
 
-    if(strlen(md5) != 32 || !isalnum(md5[0])) {
+    if(strlen(md5) != 32 || !isalnum((unsigned char)md5[0])) {
 	/* someone is trying to fool us with empty/malformed MD5 ? */
 	cli_errmsg("SECURITY WARNING: MD5 basic test failure.\n");
 	return CL_EMD5;
Index: libclamav/ole2_extract.c
===================================================================
--- libclamav/ole2_extract.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/ole2_extract.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -29,11 +29,17 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <clamav.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#include <direct.h>
+#else
+#include <unistd.h>
+#endif
+
 #if HAVE_MMAP
 #if HAVE_SYS_MMAN_H
 #include <sys/mman.h>
@@ -158,7 +164,7 @@
 	j=0;
 	/* size-2 to ignore trailing NULL */
 	for (i=0 ; i < size-2; i+=2) {
-		if (isprint(name[i])) {
+		if (isprint((unsigned char)name[i])) {
 			newname[j++] = name[i];
 		} else {
 			if (name[i] < 10 && name[i] >= 0) {
@@ -557,8 +563,12 @@
 			if (!dirname)  {
 				return;
 			}
-			snprintf(dirname, strlen(dir)+8, "%s/%.6d", dir, prop_index);
+			snprintf(dirname, strlen(dir)+8, "%s" PATH_SEPARATOR "%.6d", dir, prop_index);
+#ifdef C_WIN32
+			if (mkdir(dirname) != 0) {
+#else
 			if (mkdir(dirname, 0700) != 0) {
+#endif
 				free(dirname);
 				return;
 			}
@@ -610,7 +620,7 @@
 #ifdef  C_DARWIN
                         *newname &= '\177';
 #endif
-#if     defined(MSDOS) || defined(C_CYGWIN) || defined(WIN32) || defined(C_OS2)
+#if     defined(MSDOS) || defined(C_CYGWIN) || defined(C_WIN32) || defined(C_OS2)
                         if(strchr("/*?<>|\"+=,;: ", *newname))
 #else
                         if(*newname == '/')
@@ -625,10 +635,10 @@
 		free(name);
 		return FALSE;
 	}
-	sprintf(newname, "%s/%s", dir, name);
+	sprintf(newname, "%s" PATH_SEPARATOR "%s", dir, name);
 	free(name);
 
-	ofd = open(newname, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU);
+	ofd = open(newname, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU);
 	if (ofd < 0) {
 		cli_errmsg("ERROR: failed to create file: %s\n", newname);
 		free(newname);
@@ -750,7 +760,9 @@
 {
 	ole2_header_t hdr;
 	int hdr_size;
+#ifdef HAVE_MMAP
 	struct stat statbuf;
+#endif
 	int file_count=0;
 	
 	cli_dbgmsg("in cli_ole2_extract()\n");
Index: libclamav/vba_extract.c
===================================================================
--- libclamav/vba_extract.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/vba_extract.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -22,7 +22,6 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -30,16 +29,25 @@
 #include <ctype.h>
 #include <zlib.h>
 
-#include "clamav.h"
-
 #if HAVE_CONFIG_H
 #include "clamav-config.h"
 #endif
 
+#ifdef C_WIN32
+#include <io.h>
+#include <direct.h>
+#else
+#include <unistd.h>
+#endif
+
+#include "clamav.h"
+
 #include "vba_extract.h"
 #include "others.h"
 
+#undef FALSE
 #define FALSE (0)
+#undef TRUE
 #define TRUE (1)
 
 typedef struct vba_version_tag {
@@ -132,7 +140,7 @@
         }
         j=0;
         for (i=0 ; i < size; i += (is_mac ? 1 : 2) ) {
-                if (isprint(name[i])) {
+                if (isprint((unsigned char)name[i])) {
                         newname[j++] = name[i];
                 } else {
                         if (name[i] < 10 && name[i] >= 0) {
@@ -286,8 +294,8 @@
 	if (!fullname) {
 		return NULL;
 	}
-	sprintf(fullname, "%s/_VBA_PROJECT", dir);
-        fd = open(fullname, O_RDONLY);
+	sprintf(fullname, "%s" PATH_SEPARATOR "_VBA_PROJECT", dir);
+        fd = open(fullname, O_BINARY|O_RDONLY);
 
         if (fd == -1) {
                 cli_dbgmsg("Can't open %s\n", fullname);
@@ -750,9 +758,13 @@
 	if (!fullname) {
 		return FALSE;
 	}
-	sprintf(fullname, "%s/ppt%.8lx.doc", dir, lseek(fd, 0, SEEK_CUR));
+	sprintf(fullname, "%s" PATH_SEPARATOR "ppt%.8lx.doc", dir, lseek(fd, 0, SEEK_CUR));
 	
-	ofd = open(fullname, O_WRONLY|O_CREAT|O_TRUNC, 0600);
+#if defined(C_WIN32)
+	ofd = open(fullname, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE);
+#else
+	ofd = open(fullname, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0600);
+#endif
 	free(fullname);
         if (ofd == -1) {
                 cli_dbgmsg("ppt_unlzw Open outfile failed\n");
@@ -823,7 +835,11 @@
 	
 	/* Create a directory to store the extracted OLE2 objects */
 	out_dir = cli_gentemp(NULL);
+#ifdef C_WIN32
+	if(mkdir(out_dir)) {
+#else
 	if(mkdir(out_dir, 0700)) {
+#endif
 	    printf("ScanOLE2 -> Can't create temporary directory %s\n", out_dir);
 	    free(out_dir);
 	    close(fd);
@@ -883,8 +899,8 @@
 	if (!fullname) {
 		return NULL;
 	}
-	sprintf(fullname, "%s/PowerPoint Document", dir);
-	fd = open(fullname, O_RDONLY);
+	sprintf(fullname, "%s" PATH_SEPARATOR "PowerPoint Document", dir);
+	fd = open(fullname, O_BINARY|O_RDONLY);
 	free(fullname);
 	if (fd == -1) {
 		cli_dbgmsg("Open  PowerPoint Document failed\n");
@@ -1466,8 +1482,8 @@
 	if (!fullname) {
 		return NULL;
 	}
-	sprintf(fullname, "%s/WordDocument", dir);
-	fd = open(fullname, O_RDONLY);
+	sprintf(fullname, "%s" PATH_SEPARATOR "WordDocument", dir);
+	fd = open(fullname, O_BINARY|O_RDONLY);
 	free(fullname);
 	if (fd == -1) {
 		cli_dbgmsg("Open WordDocument failed\n");
Index: libclamav/str.c
===================================================================
--- libclamav/str.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/str.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -33,11 +33,11 @@
 
 static int cli_hex2int(int c)
 {
-	int l = tolower(c);
+	int l = tolower((unsigned char)c);
 
-    if (!isascii(l))
+    if (!isascii((unsigned char)l))
     	return -1;
-    if (isdigit(l))
+    if (isdigit((unsigned char)l))
 	return l - '0';
     if ((l >= 'a') && (l <= 'f'))
 	return l + 10 - 'a';
Index: libclamav/libclamav.vcproj
===================================================================
--- libclamav/libclamav.vcproj	(.../vendor/clamav/current)	(revision 0)
+++ libclamav/libclamav.vcproj	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,676 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libclamav"
+	ProjectGUID="{B2E5A0E5-B2FD-414D-A427-D54868B3120D}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Debug"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".,..,mspack,zziplib"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				ForceConformanceInForLoopScope="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="zlibD.lib ws2_32.lib pthreadVC2.lib libbz2D.lib gmpD.lib"
+				OutputFile="$(OutDir)\$(ProjectName)D.dll"
+				LinkIncremental="2"
+				ModuleDefinitionFile="libclamav.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName)D.pdb"
+				SubSystem="2"
+				OptimizeForWindows98="1"
+				ImportLibrary="$(OutDir)/$(ProjectName)D.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Release"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				AdditionalIncludeDirectories=".,..,mspack,zziplib"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				ForceConformanceInForLoopScope="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="zlib.lib ws2_32.lib pthreadVC2.lib libbz2.lib gmp.lib"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
+				LinkIncremental="1"
+				ModuleDefinitionFile="libclamav.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				ImportLibrary="$(OutDir)/$(ProjectName).lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\binhex.c"
+				>
+			</File>
+			<File
+				RelativePath=".\blob.c"
+				>
+			</File>
+			<File
+				RelativePath=".\chmunpack.c"
+				>
+			</File>
+			<File
+				RelativePath=".\cvd.c"
+				>
+			</File>
+			<File
+				RelativePath=".\dsig.c"
+				>
+			</File>
+			<File
+				RelativePath=".\filetypes.c"
+				>
+			</File>
+			<File
+				RelativePath=".\fsg.c"
+				>
+			</File>
+			<File
+				RelativePath=".\htmlnorm.c"
+				>
+			</File>
+			<File
+				RelativePath=".\is_tar.c"
+				>
+			</File>
+			<File
+				RelativePath=".\libclamav.def"
+				>
+			</File>
+			<File
+				RelativePath=".\line.c"
+				>
+			</File>
+			<File
+				RelativePath=".\matcher-ac.c"
+				>
+			</File>
+			<File
+				RelativePath=".\matcher-bm.c"
+				>
+			</File>
+			<File
+				RelativePath=".\matcher.c"
+				>
+			</File>
+			<File
+				RelativePath=".\mbox.c"
+				>
+			</File>
+			<File
+				RelativePath=".\md5.c"
+				>
+			</File>
+			<File
+				RelativePath=".\message.c"
+				>
+			</File>
+			<File
+				RelativePath=".\msexpand.c"
+				>
+			</File>
+			<File
+				RelativePath=".\ole2_extract.c"
+				>
+			</File>
+			<File
+				RelativePath=".\others.c"
+				>
+			</File>
+			<File
+				RelativePath=".\pe.c"
+				>
+			</File>
+			<File
+				RelativePath=".\petite.c"
+				>
+			</File>
+			<File
+				RelativePath=".\readdb.c"
+				>
+			</File>
+			<File
+				RelativePath=".\rebuildpe.c"
+				>
+			</File>
+			<File
+				RelativePath=".\scanners.c"
+				>
+			</File>
+			<File
+				RelativePath=".\snprintf.c"
+				>
+			</File>
+			<File
+				RelativePath=".\special.c"
+				>
+			</File>
+			<File
+				RelativePath=".\str.c"
+				>
+			</File>
+			<File
+				RelativePath=".\strrcpy.c"
+				>
+			</File>
+			<File
+				RelativePath=".\table.c"
+				>
+			</File>
+			<File
+				RelativePath=".\text.c"
+				>
+			</File>
+			<File
+				RelativePath=".\tnef.c"
+				>
+			</File>
+			<File
+				RelativePath=".\unrarlib.c"
+				>
+			</File>
+			<File
+				RelativePath=".\untar.c"
+				>
+			</File>
+			<File
+				RelativePath=".\upx.c"
+				>
+			</File>
+			<File
+				RelativePath=".\uuencode.c"
+				>
+			</File>
+			<File
+				RelativePath=".\vba_extract.c"
+				>
+			</File>
+			<File
+				RelativePath=".\w32_dirent.c"
+				>
+			</File>
+			<File
+				RelativePath=".\w32_time.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\binhex.h"
+				>
+			</File>
+			<File
+				RelativePath=".\blob.h"
+				>
+			</File>
+			<File
+				RelativePath=".\chmunpack.h"
+				>
+			</File>
+			<File
+				RelativePath=".\clamav.h"
+				>
+			</File>
+			<File
+				RelativePath=".\cltypes.h"
+				>
+			</File>
+			<File
+				RelativePath=".\cvd.h"
+				>
+			</File>
+			<File
+				RelativePath=".\defaults.h"
+				>
+			</File>
+			<File
+				RelativePath=".\dsig.h"
+				>
+			</File>
+			<File
+				RelativePath=".\filetypes.h"
+				>
+			</File>
+			<File
+				RelativePath=".\fsg.h"
+				>
+			</File>
+			<File
+				RelativePath=".\htmlnorm.h"
+				>
+			</File>
+			<File
+				RelativePath=".\is_tar.h"
+				>
+			</File>
+			<File
+				RelativePath=".\line.h"
+				>
+			</File>
+			<File
+				RelativePath=".\matcher-ac.h"
+				>
+			</File>
+			<File
+				RelativePath=".\matcher-bm.h"
+				>
+			</File>
+			<File
+				RelativePath=".\matcher.h"
+				>
+			</File>
+			<File
+				RelativePath=".\mbox.h"
+				>
+			</File>
+			<File
+				RelativePath=".\md5.h"
+				>
+			</File>
+			<File
+				RelativePath=".\message.h"
+				>
+			</File>
+			<File
+				RelativePath=".\msexpand.h"
+				>
+			</File>
+			<File
+				RelativePath=".\ole2_extract.h"
+				>
+			</File>
+			<File
+				RelativePath=".\others.h"
+				>
+			</File>
+			<File
+				RelativePath=".\pe.h"
+				>
+			</File>
+			<File
+				RelativePath=".\petite.h"
+				>
+			</File>
+			<File
+				RelativePath=".\readdb.h"
+				>
+			</File>
+			<File
+				RelativePath=".\rebuildpe.h"
+				>
+			</File>
+			<File
+				RelativePath=".\scanners.h"
+				>
+			</File>
+			<File
+				RelativePath=".\snprintf.h"
+				>
+			</File>
+			<File
+				RelativePath=".\special.h"
+				>
+			</File>
+			<File
+				RelativePath=".\str.h"
+				>
+			</File>
+			<File
+				RelativePath=".\strrcpy.h"
+				>
+			</File>
+			<File
+				RelativePath=".\table.h"
+				>
+			</File>
+			<File
+				RelativePath=".\text.h"
+				>
+			</File>
+			<File
+				RelativePath=".\tnef.h"
+				>
+			</File>
+			<File
+				RelativePath=".\unistd.h"
+				>
+			</File>
+			<File
+				RelativePath=".\unrarlib.h"
+				>
+			</File>
+			<File
+				RelativePath=".\untar.h"
+				>
+			</File>
+			<File
+				RelativePath=".\upx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\uuencode.h"
+				>
+			</File>
+			<File
+				RelativePath=".\vba_extract.h"
+				>
+			</File>
+			<File
+				RelativePath=".\w32_dirent.h"
+				>
+			</File>
+			<File
+				RelativePath=".\w32_time.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="mspack"
+			>
+			<Filter
+				Name="Header Files"
+				Filter="h;hpp;hxx;hm;inl;inc;xsd"
+				>
+				<File
+					RelativePath=".\mspack\cab.h"
+					>
+				</File>
+				<File
+					RelativePath=".\mspack\lzx.h"
+					>
+				</File>
+				<File
+					RelativePath=".\mspack\mspack.h"
+					>
+				</File>
+				<File
+					RelativePath=".\mspack\mszip.h"
+					>
+				</File>
+				<File
+					RelativePath=".\mspack\qtm.h"
+					>
+				</File>
+				<File
+					RelativePath=".\mspack\system.h"
+					>
+				</File>
+			</Filter>
+			<Filter
+				Name="Source Files"
+				Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+				>
+				<File
+					RelativePath=".\mspack\cabd.c"
+					>
+				</File>
+				<File
+					RelativePath=".\mspack\lzxd.c"
+					>
+				</File>
+				<File
+					RelativePath=".\mspack\mszipd.c"
+					>
+				</File>
+				<File
+					RelativePath=".\mspack\qtmd.c"
+					>
+				</File>
+				<File
+					RelativePath=".\mspack\system.c"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="zziplib"
+			>
+			<Filter
+				Name="Header Files"
+				Filter="h;hpp;hxx;hm;inl;inc;xsd"
+				>
+				<File
+					RelativePath=".\zziplib\strc.h"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-conf.h"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-config.h"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-file.h"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-io.h"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-msvc.h"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip.h"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzipformat.h"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zziplib.h"
+					>
+				</File>
+			</Filter>
+			<Filter
+				Name="Source Files"
+				Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+				>
+				<File
+					RelativePath=".\zziplib\strc.c"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-dir.c"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-err.c"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-file.c"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-info.c"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-io.c"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-stat.c"
+					>
+				</File>
+				<File
+					RelativePath=".\zziplib\zzip-zip.c"
+					>
+				</File>
+			</Filter>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes on: libclamav/libclamav.vcproj
___________________________________________________________________
Name: svn:eol-style
   + CRLF

Index: libclamav/upx.c
===================================================================
--- libclamav/upx.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/upx.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -46,9 +46,13 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <string.h>
 
+#ifdef C_WIN32
+#else
+#include <unistd.h>
+#endif
+
 #include "cltypes.h"
 #include "others.h"
 
Index: libclamav/scanners.c
===================================================================
--- libclamav/scanners.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/scanners.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -25,13 +25,20 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <fcntl.h>
+
+#ifdef C_WIN32
+#include <winsock2.h>
+#include <direct.h>
+#include <io.h>
+#include "w32_dirent.h"
+#else
+#include <dirent.h>
 #include <unistd.h>
 #include <sys/param.h>
-#include <fcntl.h>
-#include <dirent.h>
 #include <netinet/in.h>
+#endif
 
-
 #if HAVE_MMAP
 #if HAVE_SYS_MMAN_H
 #include <sys/mman.h>
@@ -69,6 +76,7 @@
 #include "untar.h"
 #include "special.h"
 #include "binhex.h"
+#include "tnef.h"
 
 #ifdef HAVE_ZLIB_H
 #include <zlib.h>
@@ -254,7 +262,7 @@
             continue;
         }
 
-	if((tmp = tmpfile()) == NULL) {
+	if((tmp = cli_tmpfile()) == NULL) {
 	    cli_dbgmsg("RAR: Can't generate temporary file.\n");
 #ifdef CL_THREAD_SAFE
 	    pthread_mutex_unlock(&cli_scanrar_mutex);
@@ -378,7 +386,7 @@
 	 * Bit 6: Strong encryption was used
 	 * Bit 13: Encrypted central directory
 	 */
-	encrypted = (zdirent.d_flags & 0x2041 != 0);
+	encrypted = (zdirent.d_flags & 0x2041) != 0;
 
 	cli_dbgmsg("Zip: %s, crc32: 0x%x, offset: %d, encrypted: %d, compressed: %u, normal: %u, method: %d, ratio: %d (max: %d)\n", zdirent.d_name, zdirent.d_crc32, zdirent.d_off, encrypted, zdirent.d_csize, zdirent.st_size, zdirent.d_compr, zdirent.d_csize ? (zdirent.st_size / zdirent.d_csize) : 0, limits ? limits->maxratio : 0);
 
@@ -498,7 +506,7 @@
 	}
 
 	/* generate temporary file and get its descriptor */
-	if((tmp = tmpfile()) == NULL) {
+	if((tmp = cli_tmpfile()) == NULL) {
 	    cli_dbgmsg("Zip: Can't generate tmpfile().\n");
 	    zzip_file_close(zfp);
 	    ret = CL_ETMPFILE;
@@ -578,7 +586,7 @@
 	return CL_EGZIP;
     }
 
-    if((tmp = tmpfile()) == NULL) {
+    if((tmp = cli_tmpfile()) == NULL) {
 	cli_dbgmsg("GZip: Can't generate temporary file.\n");
 	gzclose(gd);
 	return CL_ETMPFILE;
@@ -673,7 +681,7 @@
 	return CL_EBZIP;
     }
 
-    if((tmp = tmpfile()) == NULL) {
+    if((tmp = cli_tmpfile()) == NULL) {
 	cli_dbgmsg("Bzip: Can't generate temporary file.\n");
 	BZ2_bzReadClose(&bzerror, bfd);
 	fclose(fs);
@@ -752,7 +760,7 @@
 	return CL_EMSCOMP;
     }
 
-    if((tmp = tmpfile()) == NULL) {
+    if((tmp = cli_tmpfile()) == NULL) {
 	cli_dbgmsg("SZDD: Can't generate temporary file.\n");
 	fclose(in);
 	return CL_ETMPFILE;
@@ -872,7 +880,7 @@
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
 		    /* build the full name */
 		    fname = cli_calloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
-		    sprintf(fname, "%s/%s", dirname, dent->d_name);
+		    sprintf(fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if(lstat(fname, &statbuf) != -1) {
@@ -926,8 +934,8 @@
 
 	for(i = 0; i < vba_project->count; i++) {
 	    fullname = (char *) cli_malloc(strlen(vba_project->dir) + strlen(vba_project->name[i]) + 2);
-	    sprintf(fullname, "%s/%s", vba_project->dir, vba_project->name[i]);
-	    fd = open(fullname, O_RDONLY);
+	    sprintf(fullname, "%s" PATH_SEPARATOR "%s", vba_project->dir, vba_project->name[i]);
+	    fd = open(fullname, O_BINARY|O_RDONLY);
 	    if(fd == -1) {
 		cli_dbgmsg("VBADir: Can't open file %s\n", fullname);
 		free(fullname);
@@ -971,8 +979,8 @@
     } else if ((vba_project = (vba_project_t *) wm_dir_read(dirname))) {
     	for (i = 0; i < vba_project->count; i++) {
 		fullname = (char *) cli_malloc(strlen(vba_project->dir) + strlen(vba_project->name[i]) + 2);
-		sprintf(fullname, "%s/%s", vba_project->dir, vba_project->name[i]);
-		fd = open(fullname, O_RDONLY);
+		sprintf(fullname, "%s" PATH_SEPARATOR "%s", vba_project->dir, vba_project->name[i]);
+		fd = open(fullname, O_BINARY|O_RDONLY);
 		if(fd == -1) {
 			cli_dbgmsg("VBADir: Can't open file %s\n", fullname);
 			free(fullname);
@@ -1025,7 +1033,7 @@
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
 		    /* build the full name */
 		    fname = cli_calloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
-		    sprintf(fname, "%s/%s", dirname, dent->d_name);
+		    sprintf(fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if(lstat(fname, &statbuf) != -1) {
@@ -1058,15 +1066,19 @@
     cli_dbgmsg("in cli_scanhtml()\n");
 
     tempname = cli_gentemp(NULL);
+#ifdef C_WIN32
+    if(mkdir(tempname)) {
+#else
     if(mkdir(tempname, 0700)) {
+#endif
         cli_dbgmsg("ScanHTML -> Can't create temporary directory %s\n", tempname);
 	free(tempname);
         return CL_ETMPDIR;
     }
 
     html_normalise_fd(desc, tempname, NULL);
-    snprintf(fullname, 1024, "%s/comment.html", tempname);
-    fd = open(fullname, O_RDONLY);
+    snprintf(fullname, 1024, "%s" PATH_SEPARATOR "comment.html", tempname);
+    fd = open(fullname, O_BINARY|O_RDONLY);
     if (fd >= 0) {
         ret = cli_scandesc(fd, virname, scanned, root, 0, CL_TYPE_HTML);
 	close(fd);
@@ -1080,8 +1092,8 @@
     }
 
     if (ret == CL_CLEAN) {
-	snprintf(fullname, 1024, "%s/nocomment.html", tempname);
-	fd = open(fullname, O_RDONLY);
+	snprintf(fullname, 1024, "%s" PATH_SEPARATOR "nocomment.html", tempname);
+	fd = open(fullname, O_BINARY|O_RDONLY);
 	if (fd >= 0) {
 	    ret = cli_scandesc(fd, virname, scanned, root, 0, CL_TYPE_HTML);
 	    close(fd);
@@ -1096,8 +1108,8 @@
     }
 
     if (ret == CL_CLEAN) {
-	snprintf(fullname, 1024, "%s/script.html", tempname);
-	fd = open(fullname, O_RDONLY);
+	snprintf(fullname, 1024, "%s" PATH_SEPARATOR "script.html", tempname);
+	fd = open(fullname, O_BINARY|O_RDONLY);
 	if (fd >= 0) {
 	    ret = cli_scandesc(fd, virname, scanned, root, 0, CL_TYPE_HTML);
 	    close(fd);
@@ -1112,7 +1124,7 @@
     }
 
     if (ret == CL_CLEAN) {
-    	snprintf(fullname, 1024, "%s/rfc2397", tempname);
+    	snprintf(fullname, 1024, "%s" PATH_SEPARATOR "rfc2397", tempname);
     	ret = cli_scandir(fullname, virname, scanned, root, limits, options, arec, mrec);
     }
 
@@ -1133,7 +1145,11 @@
 
     /* generate the temporary directory */
     dir = cli_gentemp(NULL);
+#ifdef C_WIN32
+    if(mkdir(dir)) {
+#else
     if(mkdir(dir, 0700)) {
+#endif
 	cli_dbgmsg("OLE2: Can't create temporary directory %s\n", dir);
 	free(dir);
 	return CL_ETMPDIR;
@@ -1169,7 +1185,11 @@
 
     /* generate temporary directory */
     dir = cli_gentemp(NULL);
+#ifdef C_WIN32
+    if(mkdir(dir)) {
+#else
     if(mkdir(dir, 0700)) {
+#endif
 	cli_errmsg("Tar: Can't create temporary directory %s\n", dir);
 	free(dir);
 	return CL_ETMPDIR;
@@ -1198,7 +1218,11 @@
     /* generate temporary directory */
     dir = cli_gentemp(NULL);
 
+#ifdef C_WIN32
+    if(mkdir(dir)) {
+#else
     if(mkdir(dir, 0700)) {
+#endif
 	cli_errmsg("Binhex: Can't create temporary directory %s\n", dir);
 	free(dir);
 	return CL_ETMPDIR;
@@ -1225,7 +1249,11 @@
     cli_dbgmsg("in cli_scanmschm()\n");	
 
     tempname = cli_gentemp(NULL);
+#ifdef C_WIN32
+    if(mkdir(tempname)) {
+#else
     if(mkdir(tempname, 0700)) {
+#endif
 	cli_dbgmsg("CHM: Can't create temporary directory %s\n", tempname);
 	free(tempname);
 	return CL_ETMPDIR;
@@ -1249,7 +1277,11 @@
     cli_dbgmsg("in cli_scanscrenc()\n");
 
     tempname = cli_gentemp(NULL);
+#ifdef C_WIN32
+    if(mkdir(tempname)) {
+#else
     if(mkdir(tempname, 0700)) {
+#endif
 	cli_dbgmsg("CHM: Can't create temporary directory %s\n", tempname);
 	free(tempname);
 	return CL_ETMPDIR;
@@ -1294,8 +1326,11 @@
 	int ret;
 	char *dir = cli_gentemp(NULL);
 
-
+#ifdef C_WIN32
+    if(mkdir(dir)) {
+#else
     if(mkdir(dir, 0700)) {
+#endif
 	cli_dbgmsg("Can't create temporary directory for tnef file %s\n", dir);
 	free(dir);
 	return CL_ETMPDIR;
@@ -1323,7 +1358,11 @@
 
     /* generate the temporary directory */
     dir = cli_gentemp(NULL);
+#ifdef C_WIN32
+    if(mkdir(dir)) {
+#else
     if(mkdir(dir, 0700)) {
+#endif
 	cli_dbgmsg("Mail: Can't create temporary directory %s\n", dir);
 	free(dir);
 	return CL_ETMPDIR;
@@ -1401,7 +1440,7 @@
 
 
     if(fstat(desc, &sb) == -1) {
-	cli_errmsg("Can's fstat descriptor %d\n", desc);
+	cli_errmsg("Can't fstat descriptor %d\n", desc);
 	return CL_EIO;
     }
 
@@ -1550,9 +1589,12 @@
     type == CL_TYPE_MAIL ? mrec-- : arec--;
 
     if(type != CL_TYPE_DATA && ret != CL_VIRUS && !root->sdb) {
-	if(cli_scanraw(desc, virname, scanned, root, limits, options, arec, mrec, type) == CL_VIRUS)
+	if((nret = cli_scanraw(desc, virname, scanned, root, limits, options, arec, mrec, type) == CL_VIRUS)) {
 	    return CL_VIRUS;
-    }
+	} else if (nret < 0) {
+		return nret;
+	}
+	}
 
     arec++;
     lseek(desc, 0, SEEK_SET);
@@ -1589,7 +1631,7 @@
 
 
     /* internal version of cl_scanfile with arec/mrec preserved */
-    if((fd = open(filename, O_RDONLY)) == -1)
+    if((fd = open(filename, O_BINARY|O_RDONLY)) == -1)
 	return CL_EOPEN;
 
     ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, arec, mrec);
@@ -1603,7 +1645,7 @@
 	int fd, ret;
 
 
-    if((fd = open(filename, O_RDONLY)) == -1)
+    if((fd = open(filename, O_BINARY|O_RDONLY)) == -1)
 	return CL_EOPEN;
 
     ret = cl_scandesc(fd, virname, scanned, root, limits, options);
Index: libclamav/special.c
===================================================================
--- libclamav/special.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/special.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -16,22 +16,34 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#ifdef HAVE_CONFIG_H
 #include "clamav-config.h"
+#endif
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <unistd.h>
-#include <netinet/in.h>
 #include <string.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#include <winsock2.h>
+#else
+#include <netinet/in.h>
+#include <unistd.h>
+#endif
+
 #include "clamav.h"
 #include "others.h"
 #include "cltypes.h"
 
+#undef FALSE
 #define FALSE (0)
+#undef TRUE
 #define TRUE (1)
 
+int cli_check_jpeg_exploit(int fd);
+
 /* NOTE: Photoshop stores data in BIG ENDIAN format, this is the opposite
 	to virtually everything else */
 #if WORDS_BIGENDIAN == 0
Index: libclamav/table.c
===================================================================
--- libclamav/table.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/table.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -21,14 +21,19 @@
 #endif
 
 #ifndef	CL_DEBUG
+#ifndef NDEBUG
 #define	NDEBUG	/* map CLAMAV debug onto standard */
 #endif
+#endif
 
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <assert.h>
 
+#ifndef C_WIN32
+#include <strings.h>
+#endif
+
 #include "table.h"
 #include "others.h"
 
Index: libclamav/w32_time.c
===================================================================
--- libclamav/w32_time.c	(.../vendor/clamav/current)	(revision 0)
+++ libclamav/w32_time.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,55 @@
+/*
+ *  Copyright (C) 2005 Mark Weaver
+ *
+ *  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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
+#if !defined(HAVE_GETTIMEOFDAY) && defined(C_WIN32)
+
+#include <windows.h>
+#include "w32_time.h"
+ 
+#define EPOCHFILETIME (116444736000000000i64)
+
+int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+	union {
+		FILETIME        ft;
+		LARGE_INTEGER   li;
+	} u;
+	__int64		t;
+	static LONG	tzflag;
+
+	if (tv) {
+		GetSystemTimeAsFileTime(&u.ft);;
+		t = (u.li.QuadPart - EPOCHFILETIME) / 10;
+		tv->tv_sec  = (long)(t / 1000000);
+		tv->tv_usec = (long)(t % 1000000);
+	}
+
+	if (tz) {
+		tz->tz_minuteswest = 0;
+		tz->tz_dsttime = 0;
+	}
+
+	return 0;
+}
+
+#endif
Index: libclamav/mspack/mspack.h
===================================================================
--- libclamav/mspack/mspack.h	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/mspack/mspack.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -126,7 +126,13 @@
 #endif
 
 #include <sys/types.h>
+
+#ifdef C_WIN32
+#include <stddef.h>
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 
 /**
  * System self-test function, to ensure both library and calling program
@@ -187,7 +193,7 @@
  * @param interface the interface to request current version of
  * @return the version of the requested interface
  */
-extern int mspack_version(int interface);
+extern int mspack_version(int interfacen);
 
 /** Pass to mspack_version() to get the overall library version */
 #define MSPACK_VER_LIBRARY   (0)
Index: libclamav/mspack/cabd.c
===================================================================
--- libclamav/mspack/cabd.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/mspack/cabd.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -1098,7 +1098,7 @@
       this->d->incab = fol->data.cab;
 
       if(fol->data.cab->base.desc) {
-        this->d->infh = sys->dopen(sys, fol->data.cab->base.desc,
+        this->d->infh = sys->dopen(sys, dup(fol->data.cab->base.desc),
 				MSPACK_SYS_OPEN_READ);
       } else {
         this->d->infh = sys->open(sys, fol->data.cab->base.filename,
Index: libclamav/mspack/system.h
===================================================================
--- libclamav/mspack/system.h	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/mspack/system.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -39,6 +39,7 @@
 /* validates a system structure */
 extern int mspack_valid_system(struct mspack_system *sys);
 
+#ifndef _MSC_VER
 /* inline memcmp() */
 static inline int memcmp(const void *s1, const void *s2, size_t n) {
   unsigned char *c1 = (unsigned char *) s1;
@@ -54,5 +55,6 @@
   while (*e) e++;
   return e - s;
 }
+#endif
 
 #endif
Index: libclamav/w32_time.h
===================================================================
--- libclamav/w32_time.h	(.../vendor/clamav/current)	(revision 0)
+++ libclamav/w32_time.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,41 @@
+/*
+ *  Copyright (C) 2005 Mark Weaver
+ *
+ *  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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef __W32_TIME_H
+#define __W32_TIME_H
+
+#ifndef HAVE_GETTIMEOFDAY
+
+#ifndef _WINSOCKAPI_
+struct timeval {
+  long tv_sec;
+  long tv_usec;
+};
+#endif
+
+struct timezone {
+	int tz_minuteswest;
+	int tz_dsttime;
+};
+
+int gettimeofday(struct timeval *tv, struct timezone *tz);
+#endif
+
+#endif /* __W32_TIME_H */
Index: libclamav/mbox.c
===================================================================
--- libclamav/mbox.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/mbox.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -22,8 +22,10 @@
 #endif
 
 #ifndef	CL_DEBUG
+#ifndef NDEBUG
 #define	NDEBUG	/* map CLAMAV debug onto standard */
 #endif
+#endif
 
 #ifdef CL_THREAD_SAFE
 #ifndef	_REENTRANT
@@ -36,15 +38,23 @@
 #include <errno.h>
 #include <assert.h>
 #include <string.h>
-#include <strings.h>
 #include <ctype.h>
 #include <time.h>
 #include <fcntl.h>
-#include <sys/param.h>
 #include <clamav.h>
-#include <dirent.h>
 #include <limits.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#include <direct.h>
+#include "w32_dirent.h"
+#else
+#include <dirent.h>
+#include <strings.h>
+#include <unistd.h>
+#include <sys/param.h>
+#endif
+
 #if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
 #include <stddef.h>
 #endif
@@ -613,7 +623,7 @@
 			}
 
 			if(b64size > 0L)
-				while((!isalnum(*b64start)) && (*b64start != '/')) {
+				while((!isalnum((unsigned char)*b64start)) && (*b64start != '/')) {
 					if(b64size-- == 0L)
 						break;
 					b64start++;
@@ -719,7 +729,7 @@
 				quotedsize--;
 			}
 
-			while(!isalnum(*quotedstart)) {
+			while(!isalnum((unsigned char)*quotedstart)) {
 				quotedstart++;
 				quotedsize--;
 			}
@@ -956,7 +966,7 @@
 		perror(tmpfilename);
 		cli_errmsg("Can't make debugging file\n");
 	} else {
-		FILE *tmpfp = fdopen(tmpfd, "w");
+		FILE *tmpfp = fdopen(tmpfd, "wb");
 
 		if(tmpfp) {
 			while(fgets(buffer, sizeof(buffer) - 1, fd) != NULL)
@@ -1213,7 +1223,7 @@
 		if(inHeader) {
 			cli_dbgmsg("parseEmailFile: check '%s' contMarker %d fullline %p\n",
 				buffer ? buffer : "", (int)contMarker, fullline);
-			if(line && isspace(line[0])) {
+			if(line && isspace((unsigned char)line[0])) {
 				char copy[sizeof(buffer)];
 
 				strcpy(copy, buffer);
@@ -1881,7 +1891,7 @@
 						 */
 						parseEmailHeader(aMessage, line, rfc821Table);
 
-						while(isspace((int)*line))
+						while(isspace((unsigned char)*line))
 							line++;
 
 						if(*line == '\0') {
@@ -1951,7 +1961,7 @@
 							inhead = 0;
 							continue;
 						}
-						if(isspace((int)*line)) {
+						if(isspace((unsigned char)*line)) {
 							/*
 							 * The first line is
 							 * continuation line.
@@ -2004,7 +2014,7 @@
 							/*if((!isspace(data[0])) &&
 							   ((quotes & 1) == 0))
 								break;*/
-							if(!isspace(data[0]))
+							if(!isspace((unsigned char)data[0]))
 								break;
 
 							if(data[1] == '\0') {
@@ -3053,14 +3063,14 @@
 	do
 		if(*ptr)
 			*ptr = '\0';
-	while((--len >= 0) && (!isgraph(*--ptr)) && (*ptr != '\n') && (*ptr != '\r'));
+	while((--len >= 0) && (!isgraph((unsigned char)*--ptr)) && (*ptr != '\n') && (*ptr != '\r'));
 #else	/* more characters can be displayed on DOS */
 	do
 #ifndef	REAL_MODE_DOS
 		if(*ptr)	/* C8.0 puts into a text area */
 #endif
 			*ptr = '\0';
-	while((--len >= 0) && ((*--ptr == '\0') || (isspace((int)*ptr))));
+	while((--len >= 0) && ((*--ptr == '\0') || (isspace((unsigned char)*ptr))));
 #endif
 	return((size_t)(len + 1));
 }
@@ -3187,7 +3197,7 @@
 					 *	the quotes, it doesn't handle
 					 *	them properly
 					 */
-					while(isspace(*ptr))
+					while(isspace((unsigned char)*ptr))
 						ptr++;
 					if(ptr[0] == '\"')
 						ptr++;
@@ -3243,7 +3253,7 @@
 								}
 							}
 
-							while(*s && !isspace(*s))
+							while(*s && !isspace((unsigned char)*s))
 								s++;
 							if(*s++ == '\0')
 								break;
@@ -3437,7 +3447,7 @@
 		if(*in == '\0')
 			break;
 		encoding = *++in;
-		encoding = tolower(encoding);
+		encoding = tolower((unsigned char)encoding);
 
 		if((encoding != 'q') && (encoding != 'b')) {
 			cli_warnmsg("Unsupported RFC2047 encoding type '%c' - if you believe this file contains a virus, submit it to www.clamav.net\n", encoding);
@@ -3518,25 +3528,14 @@
 	if(id == NULL)
 		return -1;
 
-#ifdef  CYGWIN
-	if((tmpdir = getenv("TEMP")) == (char *)NULL)
-		if((tmpdir = getenv("TMP")) == (char *)NULL)
-			if((tmpdir = getenv("TMPDIR")) == (char *)NULL)
-				tmpdir = "C:\\";
+	tmpdir = cl_gettempdir();
+	snprintf(pdir, sizeof(pdir) - 1, "%s" PATH_SEPARATOR "clamav-partial", tmpdir);
+
+#ifdef C_WIN32
+	if((mkdir(pdir) < 0) && (errno != EEXIST)) {
 #else
-	if((tmpdir = getenv("TMPDIR")) == (char *)NULL)
-		if((tmpdir = getenv("TMP")) == (char *)NULL)
-			if((tmpdir = getenv("TEMP")) == (char *)NULL)
-#ifdef	P_tmpdir
-				tmpdir = P_tmpdir;
-#else
-				tmpdir = "/tmp";
+	if((mkdir(pdir, 0700) < 0) && (errno != EEXIST)) {
 #endif
-#endif
-
-	snprintf(pdir, sizeof(pdir) - 1, "%s/clamav-partial", tmpdir);
-
-	if((mkdir(pdir, 0700) < 0) && (errno != EEXIST)) {
 		cli_errmsg("Can't create the directory '%s'\n", pdir);
 		return -1;
 	} else {
@@ -3598,7 +3597,7 @@
 			char outname[NAME_MAX + 1];
 			time_t now;
 
-			snprintf(outname, sizeof(outname) - 1, "%s/%s", dir, id);
+			snprintf(outname, sizeof(outname) - 1, "%s" PATH_SEPARATOR "%s", dir, id);
 
 			cli_dbgmsg("outname: %s\n", outname);
 
@@ -3641,7 +3640,7 @@
 						continue;
 
 					snprintf(fullname, sizeof(fullname) - 1,
-						"%s/%s", pdir, dent->d_name);
+						"%s" PATH_SEPARATOR "%s", pdir, dent->d_name);
 
 					if(strncmp(filename, dent->d_name, strlen(filename)) != 0) {
 						if(!cli_leavetemps_flag)
@@ -3822,9 +3821,11 @@
 			 */
 			len = sizeof(cmd) - 26 - strlen(dir) - strlen(name);
 #ifdef	CL_DEBUG
-			snprintf(cmd, sizeof(cmd) - 1, "GET -t10 \"%.*s\" >%s/%s", len, url, dir, name);
+			snprintf(cmd, sizeof(cmd) - 1, "GET -t10 \"%.*s\" >%s" PATH_SEPARATOR "%s", len, url, dir, name);
+#elif defined(C_WIN32)
+			snprintf(cmd, sizeof(cmd) - 1, "GET -t10 \"%.*s\" >%s" PATH_SEPARATOR "%s 2>NUL", len, url, dir, name);
 #else
-			snprintf(cmd, sizeof(cmd) - 1, "GET -t10 \"%.*s\" >%s/%s 2>/dev/null", len, url, dir, name);
+			snprintf(cmd, sizeof(cmd) - 1, "GET -t10 \"%.*s\" >%s" PATH_SEPARATOR "%s 2>/dev/null", len, url, dir, name);
 #endif
 			cmd[sizeof(cmd) - 1] = '\0';
 
@@ -3836,7 +3837,7 @@
 #ifdef	CL_THREAD_SAFE
 			pthread_mutex_unlock(&system_mutex);
 #endif
-			snprintf(cmd, sizeof(cmd), "%s/%s", dir, name);
+			snprintf(cmd, sizeof(cmd), "%s" PATH_SEPARATOR "%s", dir, name);
 			if(stat(cmd, &statb) >= 0)
 				if(statb.st_size == 0) {
 					cli_warnmsg("URL %s failed to download\n", url);
@@ -3931,7 +3932,7 @@
 		return NULL;
 	}
 
-	snprintf(fout, NAME_MAX, "%s/%s", dir, filename);
+	snprintf(fout, NAME_MAX, "%s" PATH_SEPARATOR "%s", dir, filename);
 
 	fp = fopen(fout, "wb");
 
Index: libclamav/uuencode.c
===================================================================
--- libclamav/uuencode.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/uuencode.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,7 +23,12 @@
 #include "clamav-config.h"
 #endif
 
+#ifndef C_WIN32
 #include <strings.h>
+#else
+#include <io.h>
+#include <string.h>
+#endif
 #include <stdio.h>
 #include <memory.h>
 #include <sys/stat.h>
Index: libclamav/clamav-config.h
===================================================================
--- libclamav/clamav-config.h	(.../vendor/clamav/current)	(revision 0)
+++ libclamav/clamav-config.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,412 @@
+/* clamav-config.h.in.  Generated from configure.in by autoheader.  */
+
+/* enable bind8 compatibility */
+#undef BIND_8_COMPAT
+
+/* Define if your snprintf is busted */
+#undef BROKEN_SNPRINTF
+
+/* "build clamd" */
+#undef BUILD_CLAMD
+
+/* name of the clamav group */
+#undef CLAMAVGROUP
+
+/* name of the clamav user */
+#undef CLAMAVUSER
+
+/* enable clamuko */
+#undef CLAMUKO
+
+/* enable debugging */
+#undef CL_DEBUG
+
+/* thread safe */
+#undef CL_THREAD_SAFE
+
+/* where to look for the config file */
+#undef CONFDIR
+
+/* os is aix */
+#undef C_AIX
+
+/* os is beos */
+#undef C_BEOS
+
+/* Increase thread stack size. */
+#undef C_BIGSTACK
+
+/* os is bsd flavor */
+#undef C_BSD
+
+/* os is cygwin */
+#undef C_CYGWIN
+
+/* os is darwin */
+#undef C_DARWIN
+
+/* os is hpux */
+#undef C_HPUX
+
+/* os is interix */
+#undef C_INTERIX
+
+/* os is irix */
+#undef C_IRIX
+
+/* target is linux */
+#undef C_LINUX
+
+/* os is OS/2 */
+#undef C_OS2
+
+/* os is QNX 6.x.x */
+#undef C_QNX6
+
+/* os is solaris */
+#undef C_SOLARIS
+
+/* Path to virus database directory. */
+#undef DATADIR
+
+/* Name of the main database */
+#undef DB1NAME
+
+/* Name of the daily database */
+#undef DB2NAME
+
+/* "default FD_SETSIZE value" */
+#undef DEFAULT_FD_SETSIZE
+
+/* file i/o buffer size */
+#undef FILEBUFF
+
+/* access rights in msghdr */
+#undef HAVE_ACCRIGHTS_IN_MSGHDR
+
+/* "attrib packed" */
+#undef HAVE_ATTRIB_PACKED
+
+/* have bzip2 */
+#undef HAVE_BZLIB_H
+
+/* ancillary data style fd pass */
+#undef HAVE_CONTROL_IN_MSGHDR
+
+/* Define to 1 if you have the `ctime_r' function. */
+#undef HAVE_CTIME_R
+
+/* ctime_r takes 2 arguments */
+#undef HAVE_CTIME_R_2
+
+/* ctime_r takes 3 arguments */
+#undef HAVE_CTIME_R_3
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#undef HAVE_FSEEKO
+
+/* gethostbyname_r takes 3 arguments */
+#undef HAVE_GETHOSTBYNAME_R_3
+
+/* gethostbyname_r takes 5 arguments */
+#undef HAVE_GETHOSTBYNAME_R_5
+
+/* gethostbyname_r takes 6 arguments */
+#undef HAVE_GETHOSTBYNAME_R_6
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* have gmp installed */
+#undef HAVE_GMP
+
+/* Define to 1 if you have the `inet_ntop' function. */
+#undef HAVE_INET_NTOP
+
+/* Define to 1 if you have the `initgroups' function. */
+#undef HAVE_INITGROUPS
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* in_addr_t is defined */
+#undef HAVE_IN_ADDR_T
+
+/* in_port_t is defined */
+#undef HAVE_IN_PORT_T
+
+/* Define to 1 if you have the <libmilter/mfapi.h> header file. */
+#undef HAVE_LIBMILTER_MFAPI_H
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the `memcpy' function. */
+#undef HAVE_MEMCPY
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the <ndir.h> header file. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the `poll' function. */
+#undef HAVE_POLL
+
+/* Define to 1 if you have the <poll.h> header file. */
+#undef HAVE_POLL_H
+
+/* "pragma pack" */
+#undef HAVE_PRAGMA_PACK
+
+/* readdir_r takes 2 arguments */
+#undef HAVE_READDIR_R_2
+
+/* readdir_r takes 3 arguments */
+#undef HAVE_READDIR_R_3
+
+/* Define to 1 if you have the `recvmsg' function. */
+#undef HAVE_RECVMSG
+
+/* Define to 1 if you have the <regex.h> header file. */
+#undef HAVE_REGEX_H
+
+/* have resolv.h */
+#undef HAVE_RESOLV_H
+
+/* Define to 1 if you have the `sendmsg' function. */
+#undef HAVE_SENDMSG
+
+/* Define to 1 if you have the `setgroups' function. */
+#undef HAVE_SETGROUPS
+
+/* Define to 1 if you have the `setsid' function. */
+#undef HAVE_SETSID
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strerror_r' function. */
+#undef HAVE_STRERROR_R
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strlcat' function. */
+#undef HAVE_STRLCAT
+
+/* Define to 1 if you have the `strlcpy' function. */
+#undef HAVE_STRLCPY
+
+/* Define to 1 if you have the <sys/filio.h> header file. */
+#undef HAVE_SYS_FILIO_H
+
+/* Define to 1 if you have the <sys/inttypes.h> header file. */
+#undef HAVE_SYS_INTTYPES_H
+
+/* Define to 1 if you have the <sys/int_types.h> header file. */
+#undef HAVE_SYS_INT_TYPES_H
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#undef HAVE_SYS_MMAN_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* "have <sys/select.h>" */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#undef HAVE_SYS_UIO_H
+
+/* Define to 1 if you have the <tcpd.h> header file. */
+#undef HAVE_TCPD_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* zlib installed */
+#undef HAVE_ZLIB_H
+
+/* Early Linux doesn't set cmsg fields */
+#undef INCOMPLETE_CMSG
+
+/* bzip funtions do not have bz2 prefix */
+#undef NOBZ2PREFIX
+
+/* "no fd_set" */
+#undef NO_FD_SET
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* scan buffer size */
+#undef SCANBUFF
+
+/* Define to 1 if the `setpgrp' function takes no argument. */
+#undef SETPGRP_VOID
+
+/* The number of bytes in type int */
+#undef SIZEOF_INT
+
+/* The number of bytes in type long */
+#undef SIZEOF_LONG
+
+/* The number of bytes in type long long */
+#undef SIZEOF_LONG_LONG
+
+/* The number of bytes in type short */
+#undef SIZEOF_SHORT
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* use syslog */
+#undef USE_SYSLOG
+
+/* Version number of package */
+#undef VERSION
+
+/* use libcurl in mbox code */
+#undef WITH_CURL
+
+/* tcpwrappers support */
+#undef WITH_TCPWRAP
+
+/* endianess */
+#undef WORDS_BIGENDIAN
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#undef _LARGEFILE_SOURCE
+
+/* thread safe */
+#undef _REENTRANT
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef off_t
+
+#define PACKAGE				"clamav"
+#define VERSION				"0.88.1"
+
+#define HAVE_STRING_H		1
+#define HAVE_IO_H			1
+#define HAVE_SNPRINTF		1
+#define HAVE_VSNPRINTF		1
+#define HAVE_GMP			1
+
+/* Note: needs libzip2 in INCLUDE/LIB */
+#define	HAVE_BZLIB_H		1
+
+/* Note: needs zlib in INCLUDE/LIB */
+#define HAVE_ZLIB_H			1
+
+#define	BUILD_CLAMD			1
+#define	CL_THREAD_SAFE		1
+#define C_WIN32				1
+
+#define FILEBUFF			8192
+#define SCANBUFF			131072
+
+#define _WIN_32
+
+#define PATH_SEPARATOR		"\\"
+#define DB1NAME				"main.cvd"
+#define DB2NAME				"daily.cvd"
+
+/* VC has no int_types or whatever */
+#define SIZEOF_SHORT		2
+#define SIZEOF_INT			4
+#define SIZEOF_LONG			4
+#define SIZEOF_LONG_LONG	8
+
+/* Unistd wrappers */
+#define lseek		_lseek
+#define snprintf	_snprintf
+#define vsnprintf	_vsnprintf
+#define mkdir		_mkdir
+#define rmdir		_rmdir
+#define open		_open
+#define close		_close
+#define read		_read
+#define write		_write
+#define dup			_dup
+#define dup2		_dup2
+#define strcasecmp	_stricmp	
+#define strncasecmp	_strnicmp
+#define stat		_stat
+#define lstat		_stat
+#define fsync		_commit
+#define chmod		_chmod
+#define access		_access
+#define inline		__inline
+#define mode_t		unsigned short
+#define getpid		_getpid
+#define getcwd		_getcwd
+#define socklen_t	int
+
+#define	S_IRWXU				(_S_IREAD | _S_IWRITE | _S_IEXEC)
+#define	S_IWUSR				_S_IWRITE
+#define	S_IRUSR				_S_IREAD
+#define S_ISLNK(x)			( 0 )
+#define S_ISREG(x)			( (x) & _S_IFREG )
+#define S_ISDIR(x)			( (x) & _S_IFDIR )
+#define R_OK				4
+#define W_OK				2
+#define F_OK				0
+#define X_OK				R_OK
+
+#if _MSC_VER >= 1400
+/* VS2005 => loads of irrelevant deprecation warnings */
+#pragma warning(disable: 4996)
+#endif

Property changes on: libclamav/clamav-config.h
___________________________________________________________________
Name: svn:eol-style
   + native

Index: libclamav/cvd.c
===================================================================
--- libclamav/cvd.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/cvd.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -31,6 +31,11 @@
 #include <zlib.h>
 #include <time.h>
 
+#ifdef C_WIN32
+#include <direct.h>
+#include <io.h>
+#endif
+
 #include "clamav.h"
 #include "others.h"
 #include "dsig.h"
@@ -51,6 +56,8 @@
 
     if((infile = gzdopen(fd, "rb")) == NULL) {
 	cli_errmsg("Can't gzdopen() descriptor %d\n", fd);
+	/* client expects us to close the fd */
+	close(fd);
 	return -1;
     }
 
@@ -340,7 +347,7 @@
 {
         char *dir, *tmp, *buffer;
 	struct cl_cvd cvd;
-	int bytes, ret;
+	int bytes, ret, tmpfd;
 	FILE *tmpd;
 	time_t stime;
 
@@ -372,7 +379,11 @@
     fseek(fd, 512, SEEK_SET);
 
     dir = cli_gentemp(NULL);
+#ifdef C_WIN32
+    if(mkdir(dir)) {
+#else
     if(mkdir(dir, 0700)) {
+#endif
 	cli_errmsg("cli_cvdload():  Can't create temporary directory %s\n", dir);
 	return CL_ETMPDIR;
     }
@@ -413,7 +424,8 @@
 	    fflush(tmpd);
 	    fseek(tmpd, 0L, SEEK_SET);
 
-	    if(cli_untgz(fileno(tmpd), dir)) {
+		tmpfd = dup(fileno(tmpd));
+	    if(tmpfd == -1 || cli_untgz(tmpfd, dir)) {
 		perror("cli_untgz");
 		cli_errmsg("cli_cvdload(): Can't unpack CVD file.\n");
 		cli_rmdirs(dir);
Index: libclamav/blob.c
===================================================================
--- libclamav/blob.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/blob.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -27,7 +27,12 @@
 #include <errno.h>
 #include <fcntl.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#else
+#include <unistd.h>
 #include <sys/param.h>	/* for NAME_MAX */
+#endif
 
 #ifdef	C_DARWIN
 #include <sys/types.h>
@@ -38,8 +43,10 @@
 #include "others.h"
 
 #ifndef	CL_DEBUG
+#ifndef NDEBUG
 #define	NDEBUG	/* map CLAMAV debug onto standard */
 #endif
+#endif
 
 #ifndef	O_BINARY
 #define	O_BINARY	0
@@ -399,15 +406,18 @@
 	 * QNX6 support from mikep@kaluga.org to fix bug where mkstemp
 	 * can return ETOOLONG even when the file name isn't too long
 	 */
-	snprintf(fullname, sizeof(fullname), "%s/clamavtmpXXXXXXXXXXXXX", dir);
+	snprintf(fullname, sizeof(fullname), "%s" PATH_SEPARATOR "clamavtmpXXXXXXXXXXXXX", dir);
 #else
-	snprintf(fullname, sizeof(fullname) - 1, "%s/%.*sXXXXXX", dir,
+	snprintf(fullname, sizeof(fullname) - 1, "%s" PATH_SEPARATOR "%.*sXXXXXX", dir,
 		(int)(sizeof(fullname) - 9 - strlen(dir)), filename);
 #endif
 
 #if	defined(C_LINUX) || defined(C_BSD) || defined(HAVE_MKSTEMP) || defined(C_SOLARIS) || defined(C_CYGWIN) || defined(C_QNX6)
 	cli_dbgmsg("fileblobSetFilename: mkstemp(%s)\n", fullname);
 	fd = mkstemp(fullname);
+#elif defined(C_WIN32)
+	cli_dbgmsg("fileblobSetFilename: cl_mkstemp(%s)\n", fullname);
+	fd = cli_mkstemp(fullname);
 #else
 	cli_dbgmsg("fileblobSetFilename: mktemp(%s)\n", fullname);
 	(void)mktemp(fullname);
@@ -480,7 +490,7 @@
 		*name &= '\177';
 #endif
 		/* Also check for tab - "Heinz Martin" <Martin@hemag.ch> */
-#if	defined(MSDOS) || defined(C_CYGWIN) || defined(WIN32) || defined(C_OS2)
+#if	defined(MSDOS) || defined(C_CYGWIN) || defined(C_WIN32) || defined(C_OS2)
 		if(strchr("/*?<>|\\\"+=,;:\t ", *name))
 #else
 		if(*name == '/')
Index: libclamav/readdb.c
===================================================================
--- libclamav/readdb.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/readdb.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -24,16 +24,24 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include <unistd.h>
-#include <dirent.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/param.h>
 #include <fcntl.h>
 
+#ifdef _WIN32
+#include <io.h>
+#include "w32_dirent.h"
+#include <tchar.h>
+#include <windows.h>
+#else
+#include <unistd.h>
+#include <sys/param.h>
+#include <strings.h>
+#include <dirent.h>
+#endif
+
 #include "clamav.h"
 #include "cvd.h"
-#include "strings.h"
 #include "matcher-ac.h"
 #include "matcher-bm.h"
 #include "others.h"
@@ -58,6 +66,13 @@
 # endif
 #endif
 
+#ifdef C_WIN32
+#ifdef CL_THREAD_SAFE
+#  include <pthread.h>
+pthread_mutex_t regQueryMutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+#endif
+
 /* TODO: clean up the code */
 
 static int cli_ac_addsig(struct cl_node *root, const char *virname, const char *hexsig, int sigid, int parts, int partno, unsigned short type, unsigned int mindist, unsigned int maxdist, char *offset, unsigned short target)
@@ -549,7 +564,7 @@
 	}
 
 	if((pt = cli_strtok(buffer, 4, ":"))) { /* min version */
-	    if(!isdigit(*pt)) {
+	    if(!isdigit((unsigned char)*pt)) {
 		free(virname);
 		free(pt);
 		ret = CL_EMALFDB;
@@ -586,7 +601,7 @@
 
 	}
 
-	if(!(pt = cli_strtok(buffer, 1, ":")) || !isdigit(*pt)) {
+	if(!(pt = cli_strtok(buffer, 1, ":")) || !isdigit((unsigned char)*pt)) {
 	    free(virname);
 	    if(pt)
 		free(pt);
@@ -1018,7 +1033,7 @@
 		    closedir(dd);
 		    return CL_EMEM;
 		}
-		sprintf(dbfile, "%s/%s", dirname, dent->d_name);
+		sprintf(dbfile, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
 		if((ret = cl_loaddb(dbfile, root, signo))) {
 		    cli_dbgmsg("cl_loaddbdir(): error loading database %s\n", dbfile);
 		    free(dbfile);
@@ -1034,11 +1049,84 @@
     return 0;
 }
 
+#ifdef C_WIN32
+static char confDir[MAX_PATH];
+static char dataDir[MAX_PATH];
+#endif
+
+void cl_queryregistry(void)
+{
+	static int done;
+	DWORD bufLen;
+	HKEY hKey;
+	LONG err;
+	DWORD type;
+
+	if (done)
+		return;
+
+#ifdef CL_THREAD_SAFE
+	pthread_mutex_lock(&regQueryMutex);
+	if (done) {
+		pthread_mutex_unlock(&regQueryMutex);
+		return;
+	}
+#endif
+	/* try registry */
+	err = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\ClamAV"), &hKey);
+	if (err == ERROR_SUCCESS) {
+		bufLen = sizeof(confDir);
+		err = RegQueryValueExA(hKey, "ConfDir", NULL, &type, (LPBYTE)confDir, &bufLen);
+		if (!(err == ERROR_SUCCESS && type == REG_SZ))
+			confDir[0] = '\0';
+
+		bufLen = sizeof(dataDir);
+		err = RegQueryValueExA(hKey, "DataDir", NULL, &type, (LPBYTE)dataDir, &bufLen);
+		if (!(err == ERROR_SUCCESS && type == REG_SZ))
+			dataDir[0] = '\0';
+		RegCloseKey(hKey);
+	}
+	/* oh well -- little point having built-in defaults as windows has no fixed
+	   drive structure
+	 */
+
+#ifdef CL_THREAD_SAFE
+	pthread_mutex_unlock(&regQueryMutex);
+#endif
+}
+
 const char *cl_retdbdir(void)
 {
+#ifdef C_WIN32
+	cl_queryregistry();
+	return dataDir;
+#else
     return DATADIR;
+#endif
 }
 
+const char *cl_retconfdir(void)
+{
+#ifdef C_WIN32
+	cl_queryregistry();
+	return confDir;
+#else
+	return CONFDIR;
+#endif
+}
+
+char *cl_retconfpath(const char *name)
+{
+	const char *confDir = cl_retconfdir();
+	char *buf = cli_malloc(strlen(name) + strlen(confDir) + strlen(PATH_SEPARATOR) + 1);
+	if (!buf)
+		return NULL;
+	strcpy(buf, confDir);
+	strcat(buf, PATH_SEPARATOR);
+	strcat(buf, name);
+	return buf;
+}
+
 int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
 {
 	DIR *dd;
@@ -1094,13 +1182,13 @@
 
 		dbstat->no++;
 		dbstat->stattab = (struct stat *) realloc(dbstat->stattab, dbstat->no * sizeof(struct stat));
-#if defined(C_INTERIX) || defined(C_OS2)
+#if defined(C_INTERIX) || defined(C_OS2) || defined(C_WIN32)
 		dbstat->statdname = (char **) realloc(dbstat->statdname, dbstat->no * sizeof(char *));
 #endif
 
                 fname = cli_calloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
-		sprintf(fname, "%s/%s", dirname, dent->d_name);
-#if defined(C_INTERIX) || defined(C_OS2)
+		sprintf(fname, "%s" PATH_SEPARATOR "%s", dirname, dent->d_name);
+#if defined(C_INTERIX) || defined(C_OS2) || defined(C_WIN32)
 		dbstat->statdname[dbstat->no - 1] = (char *) calloc(strlen(dent->d_name) + 1, sizeof(char));
 		strcpy(dbstat->statdname[dbstat->no - 1], dent->d_name);
 #endif
@@ -1165,13 +1253,13 @@
 	    cli_strbcasestr(dent->d_name, ".cvd"))) {
 
                 fname = cli_calloc(strlen(dbstat->dir) + strlen(dent->d_name) + 2, sizeof(char));
-		sprintf(fname, "%s/%s", dbstat->dir, dent->d_name);
+		sprintf(fname, "%s" PATH_SEPARATOR "%s", dbstat->dir, dent->d_name);
 		stat(fname, &sb);
 		free(fname);
 
 		found = 0;
 		for(i = 0; i < dbstat->no; i++)
-#if defined(C_INTERIX) || defined(C_OS2)
+#if defined(C_INTERIX) || defined(C_OS2) || defined(C_WIN32)
 		    if(!strcmp(dbstat->statdname[i], dent->d_name)) {
 #else
 		    if(dbstat->stattab[i].st_ino == sb.st_ino) {
@@ -1200,7 +1288,7 @@
 
     if(dbstat) {
 
-#if defined(C_INTERIX) || defined(C_OS2)
+#if defined(C_INTERIX) || defined(C_OS2) || defined(C_WIN32)
 	    int i;
 
 	for(i = 0;i < dbstat->no; i++) {
Index: libclamav/matcher.c
===================================================================
--- libclamav/matcher.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/matcher.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -24,7 +24,12 @@
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 
 #include "clamav.h"
 #include "others.h"
@@ -103,7 +108,7 @@
 	int n;
 
 
-    if(isdigit(offstr[0])) {
+    if(isdigit((unsigned char)offstr[0])) {
 	return atoi(offstr);
     } if(!strncmp(offstr, "EP+", 3) || !strncmp(offstr, "EP-", 3)) {
 	if((n = lseek(fd, 0, SEEK_CUR)) == -1) {
Index: libclamav/untar.c
===================================================================
--- libclamav/untar.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/untar.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -99,13 +99,22 @@
  */
 static	char	const	rcsid[] = "$Id: untar.c,v 1.25 2005/03/22 21:26:27 kojm Exp $";
 
+#ifdef HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#else
+#include <unistd.h>
 #include <sys/param.h>	/* for NAME_MAX */
+#endif
 
 #include "clamav.h"
 #include "others.h"
@@ -243,10 +252,12 @@
 					suffixLen = 0;
 				}
 			}
-			snprintf(fullname, sizeof(fullname) - 1 - suffixLen, "%s/%.*sXXXXXX", dir,
+			snprintf(fullname, sizeof(fullname) - 1 - suffixLen, "%s" PATH_SEPARATOR "%.*sXXXXXX", dir,
 				(int)(sizeof(fullname) - 9 - suffixLen - strlen(dir)), name);
 #if	defined(C_LINUX) || defined(C_BSD) || defined(HAVE_MKSTEMP) || defined(C_SOLARIS) || defined(C_CYGWIN)
 			fd = mkstemp(fullname);
+#elif defined(C_WIN32)
+			fd = cli_mkstemp(fullname);
 #else
 			(void)mktemp(fullname);
 			fd = open(fullname, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_BINARY, 0600);
Index: libclamav/petite.c
===================================================================
--- libclamav/petite.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/petite.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -51,9 +51,14 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <string.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
 #include "cltypes.h"
 #include "pe.h"
 #include "rebuildpe.h"
Index: libclamav/tnef.c
===================================================================
--- libclamav/tnef.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/tnef.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -29,6 +29,10 @@
 #include <stdio.h>
 #include <fcntl.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#endif
+
 #include "cltypes.h"
 #include "clamav.h"
 #include "others.h"
@@ -174,7 +178,9 @@
 					char *filename = cli_gentemp(NULL);
 					char buffer[BUFSIZ];
 
-#ifdef	O_BINARY
+#if defined(C_WIN32)
+					fout = open(filename, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_BINARY, S_IREAD|S_IWRITE);
+#elif defined(O_BINARY)
 					fout = open(filename, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_BINARY, 0600);
 #else
 					fout = open(filename, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600);
Index: libclamav/htmlnorm.c
===================================================================
--- libclamav/htmlnorm.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/htmlnorm.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -21,8 +21,11 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
 #include <stdio.h>
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -31,8 +34,11 @@
 #include <stdio.h>
 #include <ctype.h>
 
-#if HAVE_CONFIG_H
-#include "clamav-config.h"
+#ifdef C_WIN32
+#include <io.h>
+#include <direct.h>
+#else
+#include <unistd.h>
 #endif
 
 #if HAVE_MMAP
@@ -185,7 +191,7 @@
 			/* Hit max_len */
 			/* Store the current line end and length*/
 			count = line_len;
-			while (!isspace(*ptr) && (line_len > 1)) {
+			while (!isspace((unsigned char)*ptr) && (line_len > 1)) {
 				ptr--;
 				line_len--;
 			}
@@ -215,7 +221,7 @@
 		if (line_len == max_len-1) {
 			/* didn't find a whole line - rewind to a space*/
 			count = 0;
-			while (!isspace(line[--line_len])) {
+			while (!isspace((unsigned char)line[--line_len])) {
 				count--;
 				if (line_len == 0) {
 					return line;
@@ -359,7 +365,7 @@
 			html_output_str(fbuff, "=\"", 2);
 			len = strlen((char *) tags->value[i]);
 			for (j=0 ; j<len ; j++) {
-				html_output_c(fbuff, NULL, tolower(tags->value[i][j]));
+				html_output_c(fbuff, NULL, tolower((unsigned char)tags->value[i][j]));
 			}
 			html_output_c(fbuff, NULL, '"');
 		}
@@ -413,7 +419,7 @@
 		if (fd_tmp < 0) {
 			return FALSE;
 		}
-		stream_in = fdopen(fd_tmp, "r");
+		stream_in = fdopen(fd_tmp, "rb");
 		if (!stream_in) {
 			close(fd_tmp);
 			return FALSE;
@@ -425,8 +431,12 @@
 	tag_args.value = NULL;
 	
 	if (dirname) {
-		snprintf(filename, 1024, "%s/rfc2397", dirname);
+		snprintf(filename, 1024, "%s" PATH_SEPARATOR "rfc2397", dirname);
+#ifdef C_WIN32
+		if (mkdir(filename)) {
+#else
 		if (mkdir(filename, 0700)) {
+#endif
 			file_buff_o1 = file_buff_o2 = file_buff_script = NULL;
 			goto abort;
 		}
@@ -451,8 +461,8 @@
 			goto abort;
 		}
 		
-		snprintf(filename, 1024, "%s/comment.html", dirname);
-		file_buff_o1->fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
+		snprintf(filename, 1024, "%s" PATH_SEPARATOR "comment.html", dirname);
+		file_buff_o1->fd = open(filename, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
 		if (!file_buff_o1->fd) {
 			cli_dbgmsg("open failed: %s\n", filename);
 			free(file_buff_o1);
@@ -462,8 +472,8 @@
 			goto abort;
 		}
 
-		snprintf(filename, 1024, "%s/nocomment.html", dirname);
-		file_buff_o2->fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
+		snprintf(filename, 1024, "%s" PATH_SEPARATOR "nocomment.html", dirname);
+		file_buff_o2->fd = open(filename, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
 		if (!file_buff_o2->fd) {
 			cli_dbgmsg("open failed: %s\n", filename);
 			close(file_buff_o1->fd);
@@ -474,8 +484,8 @@
 			goto abort;
 		}
 
-		snprintf(filename, 1024, "%s/script.html", dirname);
-		file_buff_script->fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
+		snprintf(filename, 1024, "%s" PATH_SEPARATOR "script.html", dirname);
+		file_buff_script->fd = open(filename, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
 		if (!file_buff_script->fd) {
 			cli_dbgmsg("open failed: %s\n", filename);
 			close(file_buff_o1->fd);
@@ -500,7 +510,7 @@
 		
 	ptr = line = cli_readline(stream_in, m_area, 8192);
 	while (line) {
-		while (*ptr && isspace(*ptr)) {
+		while (*ptr && isspace((unsigned char)*ptr)) {
 			ptr++;
 		}
 		while (*ptr) {
@@ -526,7 +536,7 @@
 				}
 				break;
 			case HTML_SKIP_WS:
-				if (isspace(*ptr)) {
+				if (isspace((unsigned char)*ptr)) {
 					ptr++;
 				} else {
 					state = next_state;
@@ -534,7 +544,7 @@
 				}
 				break;
 			case HTML_TRIM_WS:
-				if (isspace(*ptr)) {
+				if (isspace((unsigned char)*ptr)) {
 					ptr++;
 				} else {
 					html_output_c(file_buff_o1, file_buff_o2, ' ');
@@ -552,7 +562,7 @@
 					state = HTML_SKIP_WS;
 					tag_length=0;
 					next_state = HTML_TAG;
-				} else if (isspace(*ptr)) {
+				} else if (isspace((unsigned char)*ptr)) {
 					state = HTML_TRIM_WS;
 					next_state = HTML_NORM;
 				} else if (*ptr == '&') {
@@ -560,9 +570,9 @@
 					next_state = HTML_NORM;
 					ptr++;
 				} else {
-					html_output_c(file_buff_o1, file_buff_o2, tolower(*ptr));
+					html_output_c(file_buff_o1, file_buff_o2, tolower((unsigned char)*ptr));
 					if (in_script) {
-						html_output_c(file_buff_script, NULL, tolower(*ptr));
+						html_output_c(file_buff_script, NULL, tolower((unsigned char)*ptr));
 					}
 					ptr++;
 				}
@@ -590,13 +600,13 @@
 					tag[tag_length] = '\0';
 					state = HTML_SKIP_WS;
 					next_state = HTML_PROCESS_TAG;
-				} else if (!isspace(*ptr)) {
-					html_output_c(file_buff_o1, file_buff_o2, tolower(*ptr));
+				} else if (!isspace((unsigned char)*ptr)) {
+					html_output_c(file_buff_o1, file_buff_o2, tolower((unsigned char)*ptr));
 					if (in_script) {
-						html_output_c(file_buff_script, NULL, tolower(*ptr));
+						html_output_c(file_buff_script, NULL, tolower((unsigned char)*ptr));
 					}
 					if (tag_length < HTML_STR_LENGTH) {
-						tag[tag_length++] = tolower(*ptr);
+						tag[tag_length++] = tolower((unsigned char)*ptr);
 					}
 					ptr++;
 				}  else {
@@ -616,7 +626,7 @@
 					quoted = NOT_QUOTED;
 					tag_val_length = 0;
 					next_state = HTML_TAG_ARG_VAL;
-				} else if (isspace(*ptr)) {
+				} else if (isspace((unsigned char)*ptr)) {
 					ptr++;
 					tag_arg[tag_arg_length] = '\0';
 					state = HTML_SKIP_WS;
@@ -635,9 +645,9 @@
 						/* Start of new tag - add space */
 						html_output_c(file_buff_o1, file_buff_o2,' ');
 					}
-					html_output_c(file_buff_o1, file_buff_o2, tolower(*ptr));
+					html_output_c(file_buff_o1, file_buff_o2, tolower((unsigned char)*ptr));
 					if (tag_arg_length < HTML_STR_LENGTH) {
-						tag_arg[tag_arg_length++] = tolower(*ptr);
+						tag_arg[tag_arg_length++] = tolower((unsigned char)*ptr);
 					}
 					ptr++;
 				}
@@ -757,7 +767,7 @@
 							ptr++;
 						}
 					}
-				} else if (isspace(*ptr) || (*ptr == '>')) {
+				} else if (isspace((unsigned char)*ptr) || (*ptr == '>')) {
 					if (quoted == NOT_QUOTED) {
 						tag_val[tag_val_length] = '\0';
 						html_tag_arg_add(&tag_args, tag_arg, tag_val);
@@ -767,7 +777,7 @@
 					} else {
 						html_output_c(file_buff_o1, file_buff_o2, *ptr);
 						if (tag_val_length < HTML_STR_LENGTH) {
-							if (isspace(*ptr)) {
+							if (isspace((unsigned char)*ptr)) {
 								tag_val[tag_val_length++] = ' ';
 							} else {
 								tag_val[tag_val_length++] = '>';
@@ -780,7 +790,7 @@
 						ptr++;
 					}
 				} else {
-					html_output_c(file_buff_o1, file_buff_o2, tolower(*ptr));
+					html_output_c(file_buff_o1, file_buff_o2, tolower((unsigned char)*ptr));
 					if (tag_val_length < HTML_STR_LENGTH) {
 						tag_val[tag_val_length++] = *ptr;
 					}
@@ -794,9 +804,9 @@
 				}
 				break;
 			case HTML_COMMENT:
-				html_output_c(file_buff_o1, NULL, tolower(*ptr));
+				html_output_c(file_buff_o1, NULL, tolower((unsigned char)*ptr));
 				if (in_script) {
-					html_output_c(file_buff_script, NULL, tolower(*ptr));
+					html_output_c(file_buff_script, NULL, tolower((unsigned char)*ptr));
 				}
 				if (*ptr == '>') {
 					state = HTML_SKIP_WS;
@@ -876,16 +886,16 @@
 					state = next_state;
 					next_state = HTML_BAD_STATE;
 					ptr++;
-				} else if (isdigit(*ptr) || (hex && isxdigit(*ptr))) {
+				} else if (isdigit((unsigned char)*ptr) || (hex && isxdigit((unsigned char)*ptr))) {
 					if (hex) {
 						value *= 16;
 					} else {
 						value *= 10;
 					}
-					if (isdigit(*ptr)) {
+					if (isdigit((unsigned char)*ptr)) {
 						value += (*ptr - '0');
 					} else {
-						value += (tolower(*ptr) - 'a' + 10);
+						value += (tolower((unsigned char)*ptr) - 'a' + 10);
 					}
 					ptr++;
 				} else {
@@ -901,8 +911,8 @@
 					state = HTML_JSDECODE_LENGTH;
 					next_state = HTML_BAD_STATE;
 				} else {
-					html_output_c(file_buff_o1, file_buff_o2, tolower(*ptr));
-					html_output_c(file_buff_script, NULL, tolower(*ptr));
+					html_output_c(file_buff_o1, file_buff_o2, tolower((unsigned char)*ptr));
+					html_output_c(file_buff_script, NULL, tolower((unsigned char)*ptr));
 					ptr++;
 				}
 				break;
@@ -966,7 +976,7 @@
 						}
 					} else {
 						html_output_c(file_buff_o1, file_buff_o2, value);
-						html_output_c(file_buff_script, NULL, tolower(value));
+						html_output_c(file_buff_script, NULL, tolower((unsigned char)value));
 					}
 				}
 				table_pos = (table_pos + 1) % 64;
@@ -1001,7 +1011,7 @@
 						}
 						ptr++;
 					}
-				} else if (isspace(*ptr) || (*ptr == '>')) {
+				} else if (isspace((unsigned char)*ptr) || (*ptr == '>')) {
 					if (quoted == NOT_QUOTED) {
 						/* Early end of data detected. Error */
 						state = HTML_SKIP_WS;
@@ -1009,7 +1019,7 @@
 						next_state = HTML_TAG_ARG;
 					} else {
 						if (tag_val_length < HTML_STR_LENGTH) {
-							if (isspace(*ptr)) {
+							if (isspace((unsigned char)*ptr)) {
 								tag_val[tag_val_length++] = ' ';
 							} else {
 								tag_val[tag_val_length++] = '>';
@@ -1031,7 +1041,7 @@
 				
 				} else {
 					if (tag_val_length < HTML_STR_LENGTH) {
-						tag_val[tag_val_length++] = tolower(*ptr);
+						tag_val[tag_val_length++] = tolower((unsigned char)*ptr);
 					}
 					ptr++;
 				}
@@ -1046,10 +1056,10 @@
 				if (!file_tmp_o1) {
 					goto abort;
 				}
-				snprintf(filename, 1024, "%s/rfc2397", dirname);
+				snprintf(filename, 1024, "%s" PATH_SEPARATOR "rfc2397", dirname);
 				tmp_file = cli_gentemp(filename);
 				cli_dbgmsg("RFC2397 data file: %s\n", tmp_file);
-				file_tmp_o1->fd = open(tmp_file, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
+				file_tmp_o1->fd = open(tmp_file, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
 				free(tmp_file);
 				if (!file_tmp_o1->fd) {
 					cli_dbgmsg("open failed: %s\n", filename);
@@ -1099,7 +1109,7 @@
 						html_output_c(file_tmp_o1, NULL, *ptr);
 						ptr++;
 					}
-				} else if (isspace(*ptr) || (*ptr == '>')) {
+				} else if (isspace((unsigned char)*ptr) || (*ptr == '>')) {
 					if (quoted == NOT_QUOTED) {
 						state = HTML_RFC2397_FINISH;
 						ptr++;
@@ -1141,11 +1151,11 @@
 			case HTML_ESCAPE_CHAR:
 				value *= 16;
 				length++;
-				if (isxdigit(*ptr)) {
-					if (isdigit(*ptr)) {
+				if (isxdigit((unsigned char)*ptr)) {
+					if (isdigit((unsigned char)*ptr)) {
 						value += (*ptr - '0');
 					} else {
-						value += (tolower(*ptr) - 'a' + 10);
+						value += (tolower((unsigned char)*ptr) - 'a' + 10);
 					}
 				} else {
 					state = next_state;
@@ -1239,14 +1249,14 @@
 	if (fd_tmp < 0) {
 		return FALSE;
 	}
-	stream_in = fdopen(fd_tmp, "r");
+	stream_in = fdopen(fd_tmp, "rb");
 	if (!stream_in) {
 		close(fd_tmp);
 		return FALSE;
 	}
 	
-	snprintf((char *) filename, 1024, "%s/screnc.html", dirname);
-	file_buff.fd = open((char *) filename, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
+	snprintf((char *) filename, 1024, "%s" PATH_SEPARATOR "screnc.html", dirname);
+	file_buff.fd = open((char *) filename, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
 	file_buff.length = 0;
 	
 	if (!file_buff.fd) {
Index: libclamav/tnef.h
===================================================================
--- libclamav/tnef.h	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/tnef.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -16,4 +16,9 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#ifndef __CLI_TNEF_H
+#define __CLI_TNEF_H
+
 int cli_tnef(const char *dir, int desc);
+
+#endif /* __CLI_TNEF_H */
Index: libclamav/zziplib/zzip-stat.c
===================================================================
--- libclamav/zziplib/zzip-stat.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/zziplib/zzip-stat.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -24,7 +24,9 @@
 #include <zzip.h>                                   /* exported...*/
 #include <string.h>
 
+#ifndef C_WIN32
 #include "strc.h"
+#endif
 
 /**
  * obtain information about a filename in an opened zip-archive without 
Index: libclamav/zziplib/zzip-msvc.h
===================================================================
--- libclamav/zziplib/zzip-msvc.h	(.../vendor/clamav/current)	(revision 0)
+++ libclamav/zziplib/zzip-msvc.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,133 @@
+#ifndef _ZZIP__MSVC_H
+#define _ZZIP__MSVC_H 1
+ 
+/* zzip/_msvc.h. Generated automatically at end of configure. */
+/* config.h.in.  Generated automatically from configure.ac by autoheader.  */
+/* config values have been automatically set by zzip-msvc.sed */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef _zzip_const */
+
+/* Define if you have the <dirent.h> header file, and it defines `DIR'. */
+/* #undef ZZIP_HAVE_DIRENT_H */
+
+/* Define if you have the <dlfcn.h> header file. */
+/* #undef ZZIP_HAVE_DLFCN_H */
+
+/* Define if you have the <inttypes.h> header file. */
+/* #undef ZZIP_HAVE_INTTYPES_H */
+
+/* Define if you have the <memory.h> header file. */
+#ifndef ZZIP_HAVE_MEMORY_H 
+#define ZZIP_HAVE_MEMORY_H  1 
+#endif
+
+/* Define if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef ZZIP_HAVE_NDIR_H */
+
+/* Define if you have the <stdint.h> header file. */
+/* #undef ZZIP_HAVE_STDINT_H */
+
+/* Define if you have the <stdlib.h> header file. */
+#ifndef ZZIP_HAVE_STDLIB_H 
+#define ZZIP_HAVE_STDLIB_H  1 
+#endif
+
+/* Define if you have the <string.h> header file. */
+#ifndef ZZIP_HAVE_STRING_H 
+#define ZZIP_HAVE_STRING_H  1 
+#endif
+
+/* Define if you have the <strings.h> header file. */
+/* #undef ZZIP_HAVE_STRINGS_H */
+
+/* Define if you have the <sys/dir.h> header file, and it defines `DIR'. */
+/* #undef ZZIP_HAVE_SYS_DIR_H */
+
+/* Define if you have the <sys/int_types.h> header file. */
+/* #undef ZZIP_HAVE_SYS_INT_TYPES_H */
+
+/* Define if you have the <sys/mman.h> header file. */
+/* #undef ZZIP_HAVE_SYS_MMAN_H */
+
+/* Define if you have the <sys/ndir.h> header file, and it defines `DIR'. */
+/* #undef ZZIP_HAVE_SYS_NDIR_H */
+
+/* Define if you have the <sys/param.h> header file. */
+/* #undef ZZIP_HAVE_SYS_PARAM_H */
+
+/* Define if you have the <sys/stat.h> header file. */
+#ifndef ZZIP_HAVE_SYS_STAT_H 
+#define ZZIP_HAVE_SYS_STAT_H  1 
+#endif
+
+/* Define if you have the <sys/types.h> header file. */
+#ifndef ZZIP_HAVE_SYS_TYPES_H 
+#define ZZIP_HAVE_SYS_TYPES_H  1 
+#endif
+
+/* Define if you have the <unistd.h> header file. */
+/* #undef ZZIP_HAVE_UNISTD_H */
+
+/* Define if you have the <windows.h> header file. */
+#ifndef ZZIP_HAVE_WINDOWS_H 
+#define ZZIP_HAVE_WINDOWS_H  1  /* yes, this is windows */ 
+#endif
+
+/* Define if you have the <winnt.h> header file. */
+#ifndef ZZIP_HAVE_WINNT_H 
+#define ZZIP_HAVE_WINNT_H  1      /* is that always true? */ 
+#endif
+
+/* Define if you have the <zlib.h> header file. */
+#ifndef ZZIP_HAVE_ZLIB_H 
+#define ZZIP_HAVE_ZLIB_H  1      /* you do have it, right? */ 
+#endif
+
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+   if it is not supported. */
+#ifndef _zzip_inline 
+#define _zzip_inline  __inline 
+#endif
+
+/* Define to `long' if <sys/types.h> does not define. */
+#ifndef _zzip_off_t 
+#define _zzip_off_t  long 
+#endif
+
+/* Name of package */
+#ifndef ZZIP_PACKAGE 
+#define ZZIP_PACKAGE  "zziplib-msvc"     /* yes, make it known */ 
+#endif
+
+/* The number of bytes in type int */
+#ifndef ZZIP_SIZEOF_INT 
+#define ZZIP_SIZEOF_INT  4 
+#endif
+
+/* The number of bytes in type long */
+#ifndef ZZIP_SIZEOF_LONG 
+#define ZZIP_SIZEOF_LONG  4 
+#endif
+
+/* The number of bytes in type short */
+#ifndef ZZIP_SIZEOF_SHORT 
+#define ZZIP_SIZEOF_SHORT  2 
+#endif
+
+/* The number of bytes in type size_t */
+/* #undef ZZIP_SIZEOF_SIZE_T */
+
+/* Define if you have the ANSI C header files. */
+#ifndef ZZIP_STDC_HEADERS 
+#define ZZIP_STDC_HEADERS  1 
+#endif
+
+/* Version number of package */
+/* #undef ZZIP_VERSION */
+
+/* io-wrap needs to wrap systemcalls */
+/* #undef ZZIP_WRAPWRAP */
+ 
+/* once: _ZZIP__MSVC_H */
+#endif

Property changes on: libclamav/zziplib/zzip-msvc.h
___________________________________________________________________
Name: svn:eol-style
   + native

Index: libclamav/zziplib/zzip-file.c
===================================================================
--- libclamav/zziplib/zzip-file.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/zziplib/zzip-file.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -18,7 +18,9 @@
 #include <zzip.h>                                         /* exported...*/
 #include <zzip-file.h>
 
+#ifndef C_WIN32
 #include "strc.h"
+#endif
 
 #include <sys/types.h>  /* njh@bandsman.co.uk: for icc7.0 */
 #include <string.h>
Index: libclamav/zziplib/strc.c
===================================================================
--- libclamav/zziplib/strc.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/zziplib/strc.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -22,7 +22,7 @@
 #include "clamav-config.h"
 #endif
 
-#ifndef	C_DARWIN
+#if !defined(C_DARWIN) && !defined(C_WIN32)
 
 #include <ctype.h>
 #include <string.h>
Index: libclamav/zziplib/zzip-conf.h
===================================================================
--- libclamav/zziplib/zzip-conf.h	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/zziplib/zzip-conf.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -69,10 +69,14 @@
 #ifdef   ZZIP_ssize_t
 #define _zzip_ssize_t ZZIP_ssize_t
 #else
+#ifdef _WIN32
+#define _zzip_ssize_t long
+#else
 #include <unistd.h>
 #define _zzip_ssize_t ssize_t
 #endif
 #endif
+#endif
 
 /* whether this library shall use a 64bit off_t largefile variant in 64on32: */
 /* (some exported names must be renamed to avoid bad calls after linking) */
Index: libclamav/zziplib/zzip-zip.c
===================================================================
--- libclamav/zziplib/zzip-zip.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/zziplib/zzip-zip.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -28,7 +28,10 @@
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef C_WIN32
 #include <unistd.h>
+#endif
+#include "../others.h"
 
 /*
 #include "__mmap.h"
Index: libclamav/filetypes.c
===================================================================
--- libclamav/filetypes.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/filetypes.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -26,6 +26,10 @@
 #include <stdlib.h>
 #include <ctype.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#endif
+
 #include "clamav.h"
 #include "filetypes.h"
 #include "others.h"
@@ -118,8 +122,8 @@
     {0,  "OggS",                         4, "Ogg Stream",         CL_TYPE_DATA},
     {0,  "ID3",				 3, "MP3",		  CL_TYPE_DATA},
     {0,  "\377\373\220",		 3, "MP3",		  CL_TYPE_DATA},
-    {0,  "\%PDF-",			 5, "PDF document",	  CL_TYPE_DATA},
-    {0,  "\%!PS-Adobe-",		11, "PostScript",	  CL_TYPE_DATA},
+    {0,  "%PDF-",			 5, "PDF document",	  CL_TYPE_DATA},
+    {0,  "%!PS-Adobe-",		11, "PostScript",	  CL_TYPE_DATA},
     {0,  "\060\046\262\165\216\146\317", 7, "WMA/WMV/ASF",	  CL_TYPE_DATA},
     {0,  ".RMF" ,			 4, "Real Media File",	  CL_TYPE_DATA},
 
@@ -209,7 +213,7 @@
 
     buflen < 25 ? (len = buflen) : (len = 25);
     for(i = 0; i < len; i++)
-	if(!iscntrl(buf[i]) && !isprint(buf[i]) && !internat[buf[i] & 0xff]) {
+	if(!iscntrl((unsigned char)buf[i]) && !isprint((unsigned char)buf[i]) && !internat[(unsigned char)(buf[i] & 0xff)]) {
 	    ascii = 0;
 	    break;
 	}
Index: libclamav/pe.c
===================================================================
--- libclamav/pe.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/pe.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -28,9 +28,14 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <time.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
 #include "cltypes.h"
 #include "clamav.h"
 #include "others.h"
@@ -113,7 +118,7 @@
 	return -1;
     }
 
-    if((ndesc = open(file, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU)) < 0) {
+    if((ndesc = open(file, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU)) < 0) {
 	cli_dbgmsg("Can't create file %s\n", file);
 	lseek(desc, pos, SEEK_SET);
 	return -1;
@@ -873,7 +878,7 @@
 		cli_dbgmsg("FSG: found old EP @%x\n", oldep);
 
 		tempfile = cli_gentemp(NULL);
-		if((ndesc = open(tempfile, O_RDWR|O_CREAT|O_TRUNC, S_IRWXU)) < 0) {
+		if((ndesc = open(tempfile, O_BINARY|O_RDWR|O_CREAT|O_TRUNC, S_IRWXU)) < 0) {
 		    cli_dbgmsg("FSG: Can't create file %s\n", tempfile);
 		    free(tempfile);
 		    free(section_hdr);
@@ -922,7 +927,7 @@
 		    default: /* Everything gone wrong */
 			cli_dbgmsg("FSG: Unpacking failed\n");
 			close(ndesc);
-			unlink(tempfile); // It's empty anyway
+			unlink(tempfile); /* It's empty anyway */
 			free(tempfile);
 			free(src);
 			free(dest);
@@ -1076,7 +1081,7 @@
 		cli_dbgmsg("FSG: found old EP @%x\n", oldep);
 
 		tempfile = cli_gentemp(NULL);
-		if((ndesc = open(tempfile, O_RDWR|O_CREAT|O_TRUNC, S_IRWXU)) < 0) {
+		if((ndesc = open(tempfile, O_BINARY|O_RDWR|O_CREAT|O_TRUNC, S_IRWXU)) < 0) {
 		    cli_dbgmsg("FSG: Can't create file %s\n", tempfile);
 		    free(tempfile);
 		    free(section_hdr);
@@ -1125,7 +1130,7 @@
 		    default: /* Everything gone wrong */
 			cli_dbgmsg("FSG: Unpacking failed\n");
 			close(ndesc);
-			unlink(tempfile); // It's empty anyway
+			unlink(tempfile); /* It's empty anyway */
 			free(tempfile);
 			free(src);
 			free(dest);
@@ -1292,7 +1297,7 @@
 	    free(section_hdr);
 
 	    tempfile = cli_gentemp(NULL);
-	    if((ndesc = open(tempfile, O_RDWR|O_CREAT|O_TRUNC, S_IRWXU)) < 0) {
+	    if((ndesc = open(tempfile, O_BINARY|O_RDWR|O_CREAT|O_TRUNC, S_IRWXU)) < 0) {
 		cli_dbgmsg("UPX/FSG: Can't create file %s\n", tempfile);
 		free(tempfile);
 		free(dest);
@@ -1387,7 +1392,7 @@
 	    }
 
 	    tempfile = cli_gentemp(NULL);
-	    if((ndesc = open(tempfile, O_RDWR|O_CREAT|O_TRUNC, S_IRWXU)) < 0) {
+	    if((ndesc = open(tempfile, O_BINARY|O_RDWR|O_CREAT|O_TRUNC, S_IRWXU)) < 0) {
 		cli_dbgmsg("Petite: Can't create file %s\n", tempfile);
 		free(tempfile);
 		free(section_hdr);
Index: libclamav/matcher-ac.c
===================================================================
--- libclamav/matcher-ac.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/matcher-ac.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -28,7 +28,12 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+
+#ifdef C_WIN32
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 
 #include "clamav.h"
 #include "others.h"
Index: libclamav/strrcpy.c
===================================================================
--- libclamav/strrcpy.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/strrcpy.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -23,8 +23,10 @@
 #include <stdio.h>
 
 #ifndef	CL_DEBUG
+#ifndef NDEBUG
 #define	NDEBUG	/* map CLAMAV debug onto standard */
 #endif
+#endif
 
 #include <assert.h>
 
Index: libclamav/libclamav.def
===================================================================
--- libclamav/libclamav.def	(.../vendor/clamav/current)	(revision 0)
+++ libclamav/libclamav.def	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,104 @@
+EXPORTS
+	cl_scanbuff
+	cl_scandesc
+	cl_scanfile
+	cl_retflevel
+	cl_retver
+	cl_loaddb
+	cl_loaddbdir
+	cl_retconfpath
+	cl_retdbdir
+	cl_dup
+	cl_cvdhead
+	cl_cvdparse
+	cl_cvdverify
+	cl_cvdfree
+	cl_statinidir
+	cl_statchkdir
+	cl_statfree
+	cl_debug
+	cl_gettempdir
+	cl_settempdir
+	cl_build
+	cl_free
+	cl_strerror
+	cl_perror
+	cl_putenv
+	cl_getenv
+	cl_copyenv
+	cl_freeenv
+	gettimeofday
+	strrcpy
+	opendir
+	readdir
+	closedir
+	telldir
+	seekdir
+	rewinddir
+	cli_warnmsg
+	cli_errmsg
+	cli_dbgmsg
+	cli_malloc
+	cli_calloc
+	cli_realloc
+	cli_rmdirs
+	cli_md5digest
+	cli_md5stream
+	cli_md5file
+	cli_readn
+	cli_writen
+	cli_readint32
+	cli_writeint32
+	cli_gentemp
+	cli_mkstemp
+	cli_tmpfile
+	cli_rndnum
+	cli_filecopy
+	cli_scanpe
+	cli_peheader
+	cli_ole2_extract
+	cli_msexpand
+	cli_scandesc
+	cli_scanbuff
+	cli_validatesig
+	cli_checkfp
+	cli_bm_addpatt
+	cli_bm_init
+	cli_bm_scanbuff
+	cli_bm_free
+	cli_ac_addpatt
+	cli_ac_scanbuff
+	cli_ac_buildtrie
+	cli_ac_free
+	cli_filetype
+	cli_filetype2
+	cli_addtypesigs
+	cli_versig
+	cli_cvdload
+	cli_untgz
+	cli_binhex
+	cli_parse_add
+	cli_magic_scandesc
+	cli_check_mydoom_log
+	cli_check_jpeg_exploit
+	cli_check_riff_exploit
+	cli_strbcasestr
+	cli_chomp
+	cli_strtok
+	cli_hex2si
+	cli_hex2str
+	cli_hex2num
+	cli_str2hex
+	cli_strtokbuf
+	cli_memstr
+	cli_tnef
+	cli_untar
+	html_normalise_mem
+	html_normalise_fd
+	html_tag_arg_free
+	html_screnc_decode
+	vba56_dir_read
+	vba_decompress
+	ppt_vba_read
+	wm_dir_read
+	wm_decrypt_macro
Index: libclamav/clamav.h
===================================================================
--- libclamav/clamav.h	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/clamav.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -21,7 +21,9 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
  
 #ifdef __cplusplus
 extern "C"
@@ -197,6 +199,8 @@
 extern int cl_loaddb(const char *filename, struct cl_node **root, unsigned int *signo);
 extern int cl_loaddbdir(const char *dirname, struct cl_node **root, unsigned int *signo);
 extern const char *cl_retdbdir(void);
+extern const char *cl_retconfdir();
+extern char *cl_retconfpath(const char *name);
 extern struct cl_node *cl_dup(struct cl_node *root);
 
 /* CVD */
@@ -214,6 +218,7 @@
 extern void cl_debug(void);
 
 extern void cl_settempdir(const char *dir, short leavetemps);
+extern const char *cl_gettempdir();
 
 extern int cl_build(struct cl_node *root);
 extern void cl_free(struct cl_node *root);
@@ -221,6 +226,13 @@
 extern const char *cl_strerror(int clerror);
 extern const char *cl_perror(int clerror); /* deprecated */
 
+#ifdef C_WIN32
+extern char **cl_copyenv(size_t extra);
+extern void cl_freeenv(char **env);
+#endif
+extern char *cl_getenv(const char *var);
+extern int cl_putenv(const char *var);
+
 #ifdef __cplusplus
 };
 #endif
Index: libclamav/binhex.c
===================================================================
--- libclamav/binhex.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/binhex.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -66,8 +66,10 @@
 #endif
 
 #ifndef	CL_DEBUG
+#ifndef NDEBUG
 #define	NDEBUG	/* map CLAMAV debug onto standard */
 #endif
+#endif
 
 #ifdef CL_THREAD_SAFE
 #ifndef	_REENTRANT
Index: libclamav/unrarlib.c
===================================================================
--- libclamav/unrarlib.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/unrarlib.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -79,8 +79,8 @@
 #include <windows.h>                        /* WIN32 definitions            */
 #include <stdio.h>
 #include <string.h>
+#include <io.h>
 
-
 #define ENABLE_ACCESS
 
 #define HOST_OS     WIN_32
@@ -1169,7 +1169,7 @@
 {
   char *ChPtr;
   for (ChPtr=Str;*ChPtr;ChPtr++)
-    *ChPtr=(char)toupper(*ChPtr);
+    *ChPtr=(char)toupper((unsigned char)*ChPtr);
   return(Str);
 }
 
Index: libclamav/msexpand.c
===================================================================
--- libclamav/msexpand.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/msexpand.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -21,14 +21,20 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 
-#if HAVE_CONFIG_H
-#include "clamav-config.h"
+#ifdef C_WIN32
+#include <io.h>
+#else
+#include <unistd.h>
 #endif
+
 #include "cltypes.h"
 #include "others.h"
 
Index: libclamav/fsg.c
===================================================================
--- libclamav/fsg.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/fsg.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -40,9 +40,14 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <string.h>
 
+#ifdef C_WIN32
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
 #include "cltypes.h"
 #include "pe.h"
 #include "rebuildpe.h"
Index: libclamav/w32_dirent.c
===================================================================
--- libclamav/w32_dirent.c	(.../vendor/clamav/current)	(revision 0)
+++ libclamav/w32_dirent.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,254 @@
+/**
+ * Note: pinched from perl.  Microsoft?! wow!
+ *
+ * (c) 1995 Microsoft Corporation. All rights reserved.
+ * 		Developed by hip communications inc., http://info.hip.com/info/
+ * Portions (c) 1993 Intergraph Corporation. All rights reserved.
+ *
+ *  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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/** MDW: Adapted from perl sources */
+
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
+#include <windows.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "w32_dirent.h"
+#include "others.h"
+
+/* The idea here is to read all the directory names into a string table
+ * (separated by nulls) and when one of the other dir functions is called
+ * return the pointer to the current file name.
+ */
+DIR *opendir(const char *filename)
+{
+    DIR			*dirp;
+    long		len;
+    long		idx;
+    char		scanname[MAX_PATH+3];
+    struct stat	sbuf;
+    WIN32_FIND_DATAA	aFindData;
+    HANDLE		fh;
+    char*		ptr;
+
+    len = strlen(filename);
+	if (len > MAX_PATH) {
+		errno = EINVAL;
+		return NULL;
+	}
+
+    /* Create the search pattern */
+    strcpy(scanname, filename);
+
+	/* stat() does not like a trailing '\' or bare drive name */
+	if (len > 0)
+	{
+		switch (scanname[len - 1])
+		{
+		case '/':
+			scanname[len - 1] = '\\';
+		case '\\':
+			if (!(len == 3 && scanname[1] == ':'))
+			{
+				scanname[--len] = '\0';
+				break;
+			}
+			break;
+		case ':':
+			if (len == 2)
+			{
+				scanname[len++] = '.';
+				scanname[len++] = '\0';
+			}
+			break;
+		default:
+			break;
+		}
+	}
+
+	/* check to see if filename is a directory */
+    if (stat(scanname, &sbuf) < 0 || !S_ISDIR(sbuf.st_mode))
+		return NULL;
+
+    /* Get us a DIR structure */
+	dirp = (DIR *)cli_calloc(sizeof(DIR), 1);
+	if (dirp == NULL) {
+		errno = ENOMEM;
+		return NULL;
+	}
+
+    /* bare drive name means look in cwd for drive */
+	if (scanname[len-1] != '\\') {
+		scanname[len++] = '\\';
+    }
+    scanname[len++] = '*';
+    scanname[len] = '\0';
+
+    /* do the FindFirstFile call */
+	fh = FindFirstFileA(scanname, &aFindData);
+    dirp->handle = fh;
+
+	if (fh == INVALID_HANDLE_VALUE) {
+	DWORD err = GetLastError();
+	/* FindFirstFile() fails on empty drives! */
+	switch (err) {
+	case ERROR_FILE_NOT_FOUND:
+	    return dirp;
+	case ERROR_NO_MORE_FILES:
+	case ERROR_PATH_NOT_FOUND:
+	    errno = ENOENT;
+	    break;
+	case ERROR_NOT_ENOUGH_MEMORY:
+	    errno = ENOMEM;
+	    break;
+	default:
+	    errno = EINVAL;
+	    break;
+	}
+	free(dirp);
+	return NULL;
+    }
+
+    /* now allocate the first part of the string table for
+     * the filenames that we find.
+     */
+	ptr = aFindData.cFileName;
+    idx = strlen(ptr)+1;
+    if (idx < 256)
+	dirp->size = 128;
+    else
+	dirp->size = idx;
+    
+	dirp->start = (char *)cli_malloc(dirp->size);
+	if (dirp->start == NULL) {
+		errno = ENOMEM;
+		FindClose(fh);
+		free(dirp);
+		return NULL;
+	}
+
+    strcpy(dirp->start, ptr);
+    dirp->nfiles++;
+    dirp->end = dirp->curr = dirp->start;
+    dirp->end += idx;
+    return dirp;
+}
+
+
+/* Readdir just returns the current string pointer and bumps the
+ * string pointer to the n entry.
+ */
+struct dirent *readdir(DIR *dirp)
+{
+    long         len;
+
+    if (dirp->curr) {
+	/* first set up the structure to return */
+	len = strlen(dirp->curr);
+	strcpy(dirp->dirstr.d_name, dirp->curr);
+	dirp->dirstr.d_namlen = len;
+
+	/* Fake an inode */
+	dirp->dirstr.d_ino = 1 + dirp->curr - dirp->start;
+
+	/* Now set up for the next call to readdir */
+	dirp->curr += len + 1;
+	if (dirp->curr >= dirp->end) {
+	    char*		ptr;
+		char		*newbuf;
+	    BOOL		res;
+	    WIN32_FIND_DATAA	aFindData;
+
+	    /* finding the next file that matches the wildcard
+	     * (which should be all of them in this directory!).
+	     */
+		res = FindNextFileA(dirp->handle, &aFindData);
+		if (res)
+		    ptr = aFindData.cFileName;
+
+		if (res) {
+		long endpos = dirp->end - dirp->start;
+		long newsize = endpos + strlen(ptr) + 1;
+		/* bump the string table size by enough for the
+		 * new name and its null terminator */
+		while (newsize > dirp->size) {
+		    long curpos = dirp->curr - dirp->start;
+		    dirp->size *= 2;
+			newbuf = cli_realloc(dirp->start, dirp->size);
+			if (newbuf == NULL) {
+				errno = ENOMEM;
+				return NULL;
+			}
+			dirp->start = newbuf;
+		    dirp->curr = dirp->start + curpos;
+		}
+		strcpy(dirp->start + endpos, ptr);
+		dirp->end = dirp->start + newsize;
+		dirp->nfiles++;
+	    }
+	    else
+		dirp->curr = NULL;
+	}
+	return &(dirp->dirstr);
+    }
+    else
+	return NULL;
+}
+
+/* Telldir returns the current string pointer position */
+ long
+telldir(DIR *dirp)
+{
+    return (dirp->curr - dirp->start);
+}
+
+
+/* Seekdir moves the string pointer to a previously saved position
+ * (returned by telldir).
+ */
+ void
+seekdir(DIR *dirp, long loc)
+{
+    dirp->curr = dirp->start + loc;
+}
+
+/* Rewinddir resets the string pointer to the start */
+ void
+rewinddir(DIR *dirp)
+{
+    dirp->curr = dirp->start;
+}
+
+/* free the memory allocated by opendir */
+ int
+closedir(DIR *dirp)
+{
+	if (dirp)
+	{
+		if (dirp->handle != INVALID_HANDLE_VALUE)
+			FindClose(dirp->handle);
+		free(dirp->start);
+		free(dirp);
+	}
+    return 0;
+}
Index: libclamav/w32_dirent.h
===================================================================
--- libclamav/w32_dirent.h	(.../vendor/clamav/current)	(revision 0)
+++ libclamav/w32_dirent.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,51 @@
+/* dirent.h */
+
+/* djl
+ * Provide UNIX compatibility
+ */
+
+#ifndef  _INC_DIRENT
+#define  _INC_DIRENT
+
+/*
+ * NT versions of readdir(), etc
+ * From the MSDOS implementation
+ */
+
+/* Directory entry size */
+#ifdef DIRSIZ
+#undef DIRSIZ
+#endif
+#define DIRSIZ(rp)  (sizeof(struct dirent))
+
+/* needed to compile directory stuff */
+#define DIRENT dirent
+
+/* structure of a directory entry */
+typedef struct dirent 
+{
+	long	d_ino;			/* inode number (not used by MS-DOS)  */
+	long	d_namlen;		/* name length  */
+	char	d_name[257];		/* file name  */
+} _DIRECT;
+
+/* structure for dir operations */
+typedef struct _dir_struc
+{
+	char	*start;			/* starting position */
+	char	*curr;			/* current position */
+	long	size;			/* allocated size of string table */
+	long	nfiles;			/* number of filenames in table */
+	struct dirent dirstr;		/* directory structure to return */
+	void*	handle;			/* system handle */
+	char	*end;			/* position after last filename */
+} DIR;
+
+DIR*			opendir(const char *filename);
+struct dirent*	readdir(DIR *dirp);
+long			telldir(DIR *dirp);
+void			seekdir(DIR *dirp, long loc);
+void			rewinddir(DIR *dirp);
+int				closedir(DIR *dirp);
+
+#endif /* _INC_DIRENT */

Property changes on: libclamav/w32_dirent.h
___________________________________________________________________
Name: svn:eol-style
   + native

Index: libclamav/line.c
===================================================================
--- libclamav/line.c	(.../vendor/clamav/current)	(revision 845)
+++ libclamav/line.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -52,8 +52,10 @@
 #endif
 
 #ifndef	CL_DEBUG
+#ifndef NDEBUG
 #define	NDEBUG	/* map CLAMAV debug onto standard */
 #endif
+#endif
 
 #include <stdio.h>
 #include <string.h>
Index: target.h
===================================================================
--- target.h	(.../vendor/clamav/current)	(revision 845)
+++ target.h	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -3,11 +3,11 @@
 /* target uppercase defines */
  
 #ifndef TARGET_OS_CYGWIN
-#define TARGET_OS_CYGWIN "cygwin"
+#define TARGET_OS_CYGWIN "win32"
 #endif
  
 #ifndef TARGET_OS_TYPE
-#define TARGET_OS_TYPE "cygwin"
+#define TARGET_OS_TYPE "win32"
 #endif
  
 #ifndef TARGET_CPU_I686
@@ -32,11 +32,11 @@
 /* host uppercase defines */
  
 #ifndef HOST_OS_CYGWIN
-#define HOST_OS_CYGWIN "cygwin"
+#define HOST_OS_CYGWIN "win32"
 #endif
  
 #ifndef HOST_OS_TYPE
-#define HOST_OS_TYPE "cygwin"
+#define HOST_OS_TYPE "win32"
 #endif
  
 #ifndef HOST_CPU_I686
Index: examples/ex1.vcproj
===================================================================
--- examples/ex1.vcproj	(.../vendor/clamav/current)	(revision 0)
+++ examples/ex1.vcproj	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="ex1"
+	ProjectGUID="{1EB869A9-0110-4767-ABAD-FC1C544A5129}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..,..\libclamav"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				ForceConformanceInForLoopScope="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\$(ProjectName)D.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName)D.pdb"
+				SubSystem="1"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\bin"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				AdditionalIncludeDirectories="..,..\libclamav"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				ForceConformanceInForLoopScope="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\$(ProjectName).exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\ex1.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Property changes on: examples/ex1.vcproj
___________________________________________________________________
Name: svn:eol-style
   + CRLF

Index: examples/ex1.c
===================================================================
--- examples/ex1.c	(.../vendor/clamav/current)	(revision 845)
+++ examples/ex1.c	(.../trunk/3rdparty/clamav)	(revision 845)
@@ -18,15 +18,24 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <clamav.h>
 
+#ifdef _WIN32
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
 int main(int argc, char **argv)
 {
 	int fd, ret;
@@ -43,7 +52,7 @@
 	exit(2);
     }
 
-    if((fd = open(argv[1], O_RDONLY)) == -1) {
+    if((fd = open(argv[1], O_BINARY|O_RDONLY)) == -1) {
 	printf("Can't open file %s\n", argv[1]);
 	exit(2);
     }
