Browse code

Add clambc to the win32 build.

Török Edvin authored on 2009/12/12 03:57:41
Showing 10 changed files
... ...
@@ -23,7 +23,9 @@
23 23
 #include "clamav-config.h"
24 24
 #endif
25 25
 #include "cltypes.h"
26
+#ifndef _WIN32
26 27
 #include <sys/time.h>
28
+#endif
27 29
 #include <stdlib.h>
28 30
 #include "bytecode.h"
29 31
 #include "bytecode_priv.h"
... ...
@@ -35,7 +37,9 @@
35 35
 #include <stdlib.h>
36 36
 #include <errno.h>
37 37
 #include <string.h>
38
+#ifdef HAVE_UNISTD_H
38 39
 #include <unistd.h>
40
+#endif
39 41
 
40 42
 static void help(void)
41 43
 {
... ...
@@ -819,7 +819,7 @@ static int parseGlobals(struct cli_bc *bc, unsigned char *buffer)
819 819
 	comp = type_components(bc, bc->globaltys[i], &ok);
820 820
 	if (!ok)
821 821
 	    return CL_EMALFDB;
822
-	bc->globals[i] = cli_malloc(sizeof(bc->globals[0])*comp);
822
+	bc->globals[i] = cli_malloc(sizeof(*bc->globals[0])*comp);
823 823
 	if (!bc->globals[i])
824 824
 	    return CL_EMEM;
825 825
 	readConstant(bc, i, comp, buffer, &offset, len, &ok);
... ...
@@ -20,8 +20,14 @@
20 20
  *  MA 02110-1301, USA.
21 21
  */
22 22
 
23
+#ifdef HAVE_CONFIG_H
24
+#include "clamav-config.h"
25
+#endif
26
+
23 27
 #define _XOPEN_SOURCE 600
28
+#ifdef HAVE_UNISTD_H
24 29
 #include <unistd.h>
30
+#endif
25 31
 #include <stdlib.h>
26 32
 #include <fcntl.h>
27 33
 #include <errno.h>
... ...
@@ -25,6 +25,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clamconf", "clamconf.vcproj
25 25
 		{3AD5B16C-340A-40AC-96AD-6017B941A316} = {3AD5B16C-340A-40AC-96AD-6017B941A316}
26 26
 	EndProjectSection
27 27
 EndProject
28
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clambc", "clambc.vcproj", "{81AF8E63-81A8-4748-84E7-72DA558906B6}"
29
+EndProject
28 30
 Global
29 31
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
30 32
 		Debug|Win32 = Debug|Win32
... ...
@@ -55,6 +57,10 @@ Global
55 55
 		{DEABE3C7-6F4D-4221-8EEE-AD19C8261273}.Debug|Win32.Build.0 = Debug|Win32
56 56
 		{DEABE3C7-6F4D-4221-8EEE-AD19C8261273}.Release|Win32.ActiveCfg = Release|Win32
57 57
 		{DEABE3C7-6F4D-4221-8EEE-AD19C8261273}.Release|Win32.Build.0 = Release|Win32
58
+		{81AF8E63-81A8-4748-84E7-72DA558906B6}.Debug|Win32.ActiveCfg = Debug|Win32
59
+		{81AF8E63-81A8-4748-84E7-72DA558906B6}.Debug|Win32.Build.0 = Debug|Win32
60
+		{81AF8E63-81A8-4748-84E7-72DA558906B6}.Release|Win32.ActiveCfg = Release|Win32
61
+		{81AF8E63-81A8-4748-84E7-72DA558906B6}.Release|Win32.Build.0 = Release|Win32
58 62
 	EndGlobalSection
59 63
 	GlobalSection(SolutionProperties) = preSolution
60 64
 		HideSolutionNode = FALSE
61 65
new file mode 100644
... ...
@@ -0,0 +1,213 @@
0
+<?xml version="1.0" encoding="Windows-1252"?>
1
+<VisualStudioProject
2
+	ProjectType="Visual C++"
3
+	Version="9.00"
4
+	Name="clambc"
5
+	ProjectGUID="{81AF8E63-81A8-4748-84E7-72DA558906B6}"
6
+	RootNamespace="clambc"
7
+	Keyword="Win32Proj"
8
+	TargetFrameworkVersion="196613"
9
+	>
10
+	<Platforms>
11
+		<Platform
12
+			Name="Win32"
13
+		/>
14
+	</Platforms>
15
+	<ToolFiles>
16
+	</ToolFiles>
17
+	<Configurations>
18
+		<Configuration
19
+			Name="Debug|Win32"
20
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
21
+			IntermediateDirectory="$(ConfigurationName)"
22
+			ConfigurationType="1"
23
+			CharacterSet="1"
24
+			>
25
+			<Tool
26
+				Name="VCPreBuildEventTool"
27
+			/>
28
+			<Tool
29
+				Name="VCCustomBuildTool"
30
+			/>
31
+			<Tool
32
+				Name="VCXMLDataGeneratorTool"
33
+			/>
34
+			<Tool
35
+				Name="VCWebServiceProxyGeneratorTool"
36
+			/>
37
+			<Tool
38
+				Name="VCMIDLTool"
39
+			/>
40
+			<Tool
41
+				Name="VCCLCompilerTool"
42
+				Optimization="0"
43
+				AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)..\libclamav&quot;;&quot;$(SolutionDir)compat&quot;;&quot;$(SolutionDir)3rdparty\zlib&quot;;&quot;$(SolutionDir)3rdparty\pthreads&quot;;&quot;$(SolutionDir)3rdparty\bzip2&quot;;&quot;$(SolutionDir)..&quot;"
44
+				PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;HAVE_CONFIG_H;_BIND_TO_CURRENT_VCLIBS_VERSION=1"
45
+				MinimalRebuild="true"
46
+				BasicRuntimeChecks="3"
47
+				RuntimeLibrary="3"
48
+				UsePrecompiledHeader="0"
49
+				WarningLevel="3"
50
+				DebugInformationFormat="3"
51
+				CompileAs="1"
52
+				DisableSpecificWarnings="4996;4244"
53
+			/>
54
+			<Tool
55
+				Name="VCManagedResourceCompilerTool"
56
+			/>
57
+			<Tool
58
+				Name="VCResourceCompilerTool"
59
+			/>
60
+			<Tool
61
+				Name="VCPreLinkEventTool"
62
+			/>
63
+			<Tool
64
+				Name="VCLinkerTool"
65
+				LinkIncremental="2"
66
+				GenerateDebugInformation="true"
67
+				SubSystem="1"
68
+				RandomizedBaseAddress="1"
69
+				TargetMachine="1"
70
+			/>
71
+			<Tool
72
+				Name="VCALinkTool"
73
+			/>
74
+			<Tool
75
+				Name="VCManifestTool"
76
+			/>
77
+			<Tool
78
+				Name="VCXDCMakeTool"
79
+			/>
80
+			<Tool
81
+				Name="VCBscMakeTool"
82
+			/>
83
+			<Tool
84
+				Name="VCFxCopTool"
85
+			/>
86
+			<Tool
87
+				Name="VCAppVerifierTool"
88
+			/>
89
+			<Tool
90
+				Name="VCPostBuildEventTool"
91
+			/>
92
+		</Configuration>
93
+		<Configuration
94
+			Name="Release|Win32"
95
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
96
+			IntermediateDirectory="$(ConfigurationName)"
97
+			ConfigurationType="1"
98
+			CharacterSet="1"
99
+			WholeProgramOptimization="1"
100
+			>
101
+			<Tool
102
+				Name="VCPreBuildEventTool"
103
+			/>
104
+			<Tool
105
+				Name="VCCustomBuildTool"
106
+			/>
107
+			<Tool
108
+				Name="VCXMLDataGeneratorTool"
109
+			/>
110
+			<Tool
111
+				Name="VCWebServiceProxyGeneratorTool"
112
+			/>
113
+			<Tool
114
+				Name="VCMIDLTool"
115
+			/>
116
+			<Tool
117
+				Name="VCCLCompilerTool"
118
+				Optimization="2"
119
+				EnableIntrinsicFunctions="true"
120
+				PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;HAVE_CONFIG_H;_BIND_TO_CURRENT_VCLIBS_VERSION=1"
121
+				RuntimeLibrary="2"
122
+				EnableFunctionLevelLinking="true"
123
+				UsePrecompiledHeader="0"
124
+				WarningLevel="3"
125
+				DebugInformationFormat="3"
126
+			/>
127
+			<Tool
128
+				Name="VCManagedResourceCompilerTool"
129
+			/>
130
+			<Tool
131
+				Name="VCResourceCompilerTool"
132
+			/>
133
+			<Tool
134
+				Name="VCPreLinkEventTool"
135
+			/>
136
+			<Tool
137
+				Name="VCLinkerTool"
138
+				LinkIncremental="1"
139
+				GenerateDebugInformation="true"
140
+				SubSystem="1"
141
+				OptimizeReferences="2"
142
+				EnableCOMDATFolding="2"
143
+				TargetMachine="1"
144
+			/>
145
+			<Tool
146
+				Name="VCALinkTool"
147
+			/>
148
+			<Tool
149
+				Name="VCManifestTool"
150
+			/>
151
+			<Tool
152
+				Name="VCXDCMakeTool"
153
+			/>
154
+			<Tool
155
+				Name="VCBscMakeTool"
156
+			/>
157
+			<Tool
158
+				Name="VCFxCopTool"
159
+			/>
160
+			<Tool
161
+				Name="VCAppVerifierTool"
162
+			/>
163
+			<Tool
164
+				Name="VCPostBuildEventTool"
165
+			/>
166
+		</Configuration>
167
+	</Configurations>
168
+	<References>
169
+		<ProjectReference
170
+			ReferencedProjectIdentifier="{3AD5B16C-340A-40AC-96AD-6017B941A316}"
171
+			RelativePathToProject=".\libclamav.vcproj"
172
+		/>
173
+	</References>
174
+	<Files>
175
+		<Filter
176
+			Name="Source Files"
177
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
178
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
179
+			>
180
+			<File
181
+				RelativePath="..\clambc\bcrun.c"
182
+				>
183
+			</File>
184
+			<File
185
+				RelativePath="..\shared\getopt.c"
186
+				>
187
+			</File>
188
+			<File
189
+				RelativePath="..\shared\misc.c"
190
+				>
191
+			</File>
192
+		</Filter>
193
+		<Filter
194
+			Name="Header Files"
195
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
196
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
197
+			>
198
+		</Filter>
199
+		<Filter
200
+			Name="Resource Files"
201
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
202
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
203
+			>
204
+			<File
205
+				RelativePath=".\res\clambc.rc"
206
+				>
207
+			</File>
208
+		</Filter>
209
+	</Files>
210
+	<Globals>
211
+	</Globals>
212
+</VisualStudioProject>
... ...
@@ -1,7 +1,7 @@
1 1
 <?xml version="1.0" encoding="Windows-1252"?>
2 2
 <VisualStudioProject
3 3
 	ProjectType="Visual C++"
4
-	Version="9,00"
4
+	Version="9.00"
5 5
 	Name="clamconf"
6 6
 	ProjectGUID="{DEABE3C7-6F4D-4221-8EEE-AD19C8261273}"
7 7
 	RootNamespace="clamconf"
... ...
@@ -169,6 +169,10 @@
169 169
 		</Configuration>
170 170
 	</Configurations>
171 171
 	<References>
172
+		<ProjectReference
173
+			ReferencedProjectIdentifier="{3AD5B16C-340A-40AC-96AD-6017B941A316}"
174
+			RelativePathToProject=".\libclamav.vcproj"
175
+		/>
172 176
 	</References>
173 177
 	<Files>
174 178
 		<Filter
... ...
@@ -34,6 +34,25 @@ EXPORTS cli_decodesig
34 34
 EXPORTS cli_chomp
35 35
 EXPORTS cli_strtokenize
36 36
 EXPORTS have_rar
37
+EXPORTS have_clamjit
38
+
39
+EXPORTS cli_bytecode_done
40
+EXPORTS cli_bytecode_destroy
41
+EXPORTS cli_bytecode_context_destroy
42
+EXPORTS cli_bytecode_context_getresult_int
43
+EXPORTS cli_bytecode_run
44
+EXPORTS funmap
45
+EXPORTS cli_bytecode_context_setfile
46
+EXPORTS fmap
47
+EXPORTS cli_bytecode_context_setparam_int
48
+EXPORTS cli_bytecode_context_setfuncid
49
+EXPORTS cli_bytecode_context_set_trace
50
+EXPORTS cli_bytecode_context_alloc
51
+EXPORTS cli_bytecode_prepare
52
+EXPORTS cli_bytecode_load
53
+EXPORTS cli_bytecode_init
54
+EXPORTS cli_bytecode_debug
55
+EXPORTS cli_bytecode_debug_printsrc
37 56
 
38 57
 ; shared stuff - to be either double compiled into the tools or treated like cli_xxx
39 58
 EXPORTS opendir
... ...
@@ -1,7 +1,7 @@
1 1
 <?xml version="1.0" encoding="Windows-1252"?>
2 2
 <VisualStudioProject
3 3
 	ProjectType="Visual C++"
4
-	Version="9,00"
4
+	Version="9.00"
5 5
 	Name="libclamav"
6 6
 	ProjectGUID="{3AD5B16C-340A-40AC-96AD-6017B941A316}"
7 7
 	RootNamespace="libclamav"
... ...
@@ -221,6 +221,10 @@
221 221
 				>
222 222
 			</File>
223 223
 			<File
224
+				RelativePath="..\libclamav\bytecode_nojit.c"
225
+				>
226
+			</File>
227
+			<File
224 228
 				RelativePath="..\libclamav\bytecode_vm.c"
225 229
 				>
226 230
 			</File>
... ...
@@ -41,7 +41,7 @@ char *strptime(const char *s, const char *format, struct tm *tm);
41 41
 #define inet_ntop w32_inet_ntop
42 42
 #define gethostbyname w32_gethostbyname
43 43
 #define select w32_select
44
-
44
+#define ftruncate _chsize
45 45
 #define getpid GetCurrentProcessId
46 46
 
47 47
 #define PATH_MAX 32767
48 48
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+#define RES_FNAME "clambc.exe"
1
+#define RES_NAME "clambc"
2
+#define RES_FDESC "ClamAV - clambc"
3
+#include "common.rc"
4
+
5
+1337 ICON "clam.ico"