Browse code

clamav-for-windows: add dumb mode

aCaB authored on 2010/08/11 19:33:42
Showing 2 changed files
... ...
@@ -184,8 +184,9 @@ extern "C" {
184 184
  * INPUT @param pEnginesFolder : path where defs are located
185 185
  * INPUT @param pTempRoot : path in which temporary files must be created
186 186
  * INPUT @param pLicenseKey : license key blob
187
+ * INPUT @param bLoadMinDefs : load minimal defs
187 188
  */
188
-int CLAMAPI Scan_Initialize(const wchar_t *pEnginesFolder, const wchar_t *pTempRoot, const wchar_t *pLicenseKey);
189
+int CLAMAPI Scan_Initialize(const wchar_t *pEnginesFolder, const wchar_t *pTempRoot, const wchar_t *pLicenseKey, BOOL bLoadMinDefs);
189 190
 
190 191
 /*
191 192
  * MANDATORY SUPPORT
... ...
@@ -57,6 +57,8 @@ unsigned int ninsts_total = 0;
57 57
 unsigned int ninsts_avail = 0;
58 58
 HANDLE instance_mutex;
59 59
 
60
+BOOL minimal_definitions = FALSE;
61
+
60 62
 #define lock_engine()(WaitForSingleObject(engine_mutex, INFINITE) == WAIT_FAILED)
61 63
 #define unlock_engine() do {ReleaseMutex(engine_mutex);} while(0)
62 64
 
... ...
@@ -176,7 +178,7 @@ BOOL interface_setup(void) {
176 176
 }
177 177
 
178 178
 static int sigload_callback(const char *type, const char *name, void *context) {
179
-    if(!strncmp(name, "Exploit.PDF", 11) || !strncmp(name, "DOS.", 4) || !strcmp(type, "db")) /* FIXME */
179
+    if(minimal_definitions && strcmp(type, "fp"))
180 180
 	return 1;
181 181
     return 0;
182 182
 }
... ...
@@ -249,7 +251,7 @@ static void free_engine_and_unlock(void) {
249 249
     unlock_engine();
250 250
 }
251 251
 
252
-int CLAMAPI Scan_Initialize(const wchar_t *pEnginesFolder, const wchar_t *pTempRoot, const wchar_t *pLicenseKey) {
252
+int CLAMAPI Scan_Initialize(const wchar_t *pEnginesFolder, const wchar_t *pTempRoot, const wchar_t *pLicenseKey, BOOL bLoadMinDefs) {
253 253
     char tmpdir[PATH_MAX];
254 254
     BOOL cant_convert;
255 255
     int ret;
... ...
@@ -272,6 +274,11 @@ int CLAMAPI Scan_Initialize(const wchar_t *pEnginesFolder, const wchar_t *pTempR
272 272
     }
273 273
     cl_engine_set_clcb_pre_scan(engine, prescan_cb);
274 274
     cl_engine_set_clcb_post_scan(engine, postscan_cb);
275
+    
276
+    minimal_definitions = bLoadMinDefs;
277
+    if(bLoadMinDefs)
278
+	logg("!MINIMAL DEFINITIONS MODE ON!");
279
+
275 280
     if(!WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, pTempRoot, -1, tmpdir, sizeof(tmpdir), NULL, &cant_convert) || cant_convert) {
276 281
 	free_engine_and_unlock();
277 282
 	FAIL(CL_EARG, "Can't translate pTempRoot");