Browse code

c4w: tune glue spam

aCaB authored on 2010/12/15 03:28:32
Showing 3 changed files
... ...
@@ -74,6 +74,6 @@ void free_errors(void) {
74 74
 CLAMAPI const wchar_t * Scan_GetErrorMsg(int errorCode) {
75 75
     if(errorCode>=0 && errorCode<CL_ELAST_ERROR && clerrors[errorCode])
76 76
 	return clerrors[errorCode];
77
-    logg("Scan_GetErrorMsg called with invalid errorCode %d\n", errorCode);
77
+    logg("^Scan_GetErrorMsg called with invalid errorCode %d\n", errorCode);
78 78
     return L"GetErrorMsg called with an invalid error code";
79 79
 }
... ...
@@ -89,28 +89,28 @@ DWORD WINAPI monitor_thread(VOID *p) {
89 89
     harr[0] = monitor_event;
90 90
     harr[1] = FindFirstChangeNotification(dbdir, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_FILE_NAME);
91 91
 
92
-    logg("monitor_thread: watching directory changes on %s\n", dbdir);
93
-
94 92
     unlock_engine();
95 93
 
96 94
     if(harr[1] == INVALID_HANDLE_VALUE) {
97
-	logg("monitor_thread: failed to monitor directory changes on %s\n", dbdir);
95
+	logg("^monitor_thread: failed to monitor directory changes on %s\n", dbdir);
98 96
 	return 0;
99 97
     }
100 98
 
99
+    logg("monitor_thread: watching directory changes on %s\n", dbdir);
100
+
101 101
     while(1) {
102 102
 	WIN32_FIND_DATA wfd;
103 103
 	SYSTEMTIME st;
104 104
 
105 105
 	switch(WaitForMultipleObjects(2, harr, FALSE, INFINITE)) {
106 106
 	case WAIT_OBJECT_0:
107
-	    logg("monitor_thread: terminating upon request\n");
107
+	    logg("*monitor_thread: terminating upon request\n");
108 108
 	    FindCloseChangeNotification(harr[1]);
109 109
 	    return 0;
110 110
 	case WAIT_OBJECT_0 + 1:
111 111
 	    break;
112 112
 	default:
113
-	    logg("monitor_thread: unexpected wait failure - %u\n", GetLastError());
113
+	    logg("*monitor_thread: unexpected wait failure - %u\n", GetLastError());
114 114
 	    Sleep(1000);
115 115
 	    continue;
116 116
 	}
... ...
@@ -126,7 +126,7 @@ DWORD WINAPI monitor_thread(VOID *p) {
126 126
 	if(CompareFileTime(&wfd.ftLastWriteTime, &last_chk_time) <= 0)
127 127
 	    continue;
128 128
 
129
-	logg("*monitor_thread: reload requested!\n");
129
+	logg("monitor_thread: reload requested!\n");
130 130
 	Scan_ReloadDatabase();
131 131
 	GetSystemTime(&st);
132 132
 	SystemTimeToFileTime(&st, &last_chk_time); /* FIXME: small race here */
... ...
@@ -210,7 +210,7 @@ static int del_instance(instance *inst) {
210 210
 	unlock_instances();
211 211
 	return CL_SUCCESS;
212 212
     }
213
-    logg("!del_instances: instance not found\n");
213
+    logg("!del_instances: instance %p not found\n", inst);
214 214
     unlock_instances();
215 215
     return CL_EARG;
216 216
 }
... ...
@@ -291,7 +291,7 @@ static void touch_last_update(unsigned signo) {
291 291
 	}
292 292
 	CloseHandle(h);
293 293
     } else
294
-	logg("touch_lastcheck: failed to touch lastreload\n");
294
+	logg("^touch_last_lastcheck: failed to touch lastreload\n");
295 295
 }
296 296
 
297 297
 
... ...
@@ -336,7 +336,7 @@ int CLAMAPI Scan_Initialize(const wchar_t *pEnginesFolder, const wchar_t *pTempR
336 336
     BOOL cant_convert;
337 337
     int ret;
338 338
 
339
-    logg("in Scan_Initialize(pEnginesFolder = %S, pTempRoot = %S)\n", pEnginesFolder, pTempRoot);
339
+    logg("*in Scan_Initialize(pEnginesFolder = %S, pTempRoot = %S)\n", pEnginesFolder, pTempRoot);
340 340
     if(!pEnginesFolder)
341 341
 	FAIL(CL_ENULLARG, "pEnginesFolder is NULL");
342 342
     if(!pTempRoot)
... ...
@@ -357,7 +357,7 @@ int CLAMAPI Scan_Initialize(const wchar_t *pEnginesFolder, const wchar_t *pTempR
357 357
     
358 358
     minimal_definitions = bLoadMinDefs;
359 359
     if(bLoadMinDefs)
360
-	logg("!MINIMAL DEFINITIONS MODE ON!\n");
360
+	logg("^MINIMAL DEFINITIONS MODE ON!\n");
361 361
 
362 362
     if(!WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, pTempRoot, -1, tmpdir, sizeof(tmpdir), NULL, &cant_convert) || cant_convert) {
363 363
 	free_engine_and_unlock();
... ...
@@ -402,7 +402,7 @@ int CLAMAPI Scan_Uninitialize(void) {
402 402
     if(monitor_hdl) {
403 403
 	SetEvent(monitor_event);
404 404
 	if(WaitForSingleObject(monitor_hdl, 5000) != WAIT_OBJECT_0) {
405
-	    logg("Scan_Uninitialize: forcibly terminating monitor thread after 5 seconds\n");
405
+	    logg("^Scan_Uninitialize: forcibly terminating monitor thread after 5 seconds\n");
406 406
 	    TerminateThread(monitor_hdl, 0);
407 407
 	}
408 408
     }
... ...
@@ -450,7 +450,7 @@ int CLAMAPI Scan_CreateInstance(CClamAVScanner **ppScanner) {
450 450
     unlock_engine();
451 451
     inst->scanopts = CL_SCAN_STDOPT;
452 452
     *ppScanner = (CClamAVScanner *)inst;
453
-    logg("*Created new instance %p\n", inst);
453
+    logg("Created new instance %p\n", inst);
454 454
     WIN();
455 455
 }
456 456
 
... ...
@@ -473,7 +473,7 @@ int CLAMAPI Scan_DestroyInstance(CClamAVScanner *pScanner) {
473 473
 	    FAIL(rc, "del_instance failed for %p", pScanner);
474 474
     }
475 475
     free(pScanner);
476
-    logg("*in Scan_DestroyInstance: Instance %p destroyed\n", pScanner);
476
+    logg("in Scan_DestroyInstance: Instance %p destroyed\n", pScanner);
477 477
     WIN();
478 478
 }
479 479
 
... ...
@@ -807,7 +807,7 @@ int CLAMAPI Scan_ScanObjectByHandle(CClamAVScanner *pScanner, HANDLE object, int
807 807
     unlock_instances();
808 808
 
809 809
     if(res == CL_VIRUS) {
810
-	logg("*Scan_ScanObjectByHandle (instance %p): file is INFECTED with %s\n", inst, virname);
810
+	logg("Scan_ScanObjectByHandle (instance %p): file is INFECTED with %s\n", inst, virname);
811 811
 	if(pInfoList) {
812 812
 	    CLAM_SCAN_INFO_LIST *infolist = calloc(1, sizeof(CLAM_SCAN_INFO_LIST) + sizeof(CLAM_SCAN_INFO) + MAX_VIRNAME_LEN * 2);
813 813
 	    PCLAM_SCAN_INFO scaninfo;
... ...
@@ -825,7 +825,7 @@ int CLAMAPI Scan_ScanObjectByHandle(CClamAVScanner *pScanner, HANDLE object, int
825 825
 	    if(!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, virname, -1, wvirname, MAX_VIRNAME_LEN))
826 826
 		scaninfo->pThreatName = L"INFECTED";
827 827
 	    *pInfoList = infolist;
828
-	    logg("Scan_ScanObjectByHandle (instance %p): created result list %p\n", inst, infolist);
828
+	    logg("*Scan_ScanObjectByHandle (instance %p): created result list %p\n", inst, infolist);
829 829
 	}
830 830
 	*pScanStatus = CLAM_INFECTED;
831 831
     } else if(res == CL_CLEAN) {
... ...
@@ -1015,9 +1015,9 @@ CLAMAPI void Scan_ReloadDatabase(void) {
1015 1015
 		break;
1016 1016
 	    }
1017 1017
 
1018
-	    logg("*Scan_ReloadDatabase: Destroying old engine\n");
1018
+	    logg("Scan_ReloadDatabase: Destroying old engine\n");
1019 1019
 	    cl_engine_free(engine);
1020
-	    logg("*Scan_ReloadDatabase: Loading new engine\n");
1020
+	    logg("Scan_ReloadDatabase: Loading new engine\n");
1021 1021
 
1022 1022
 	    // NEW STUFF //
1023 1023
 	    if(!(engine = cl_engine_new())) {
... ...
@@ -1036,11 +1036,11 @@ CLAMAPI void Scan_ReloadDatabase(void) {
1036 1036
 	    break;
1037 1037
 	}
1038 1038
 	if(reload_ok)
1039
-	    logg("*Scan_ReloadDatabase: Database successfully reloaded\n");
1039
+	    logg("Scan_ReloadDatabase: Database successfully reloaded\n");
1040 1040
 	else
1041 1041
 	    logg("!Scan_ReloadDatabase: Database reload failed\n");
1042 1042
     } else
1043
-	logg("^Database reload requested received while reload is pending\n");
1043
+	logg("*Database reload requested received while reload is pending\n");
1044 1044
     InterlockedDecrement(&reload_waiters);
1045 1045
 }
1046 1046
 
... ...
@@ -25,8 +25,8 @@
25 25
 #include "shared/output.h"
26 26
 #include "interface.h"
27 27
 #include "iface_errors.h"
28
-
29
-EXTERN_C IMAGE_DOS_HEADER __ImageBase; /* Reloc safe! */
28
+
29
+EXTERN_C IMAGE_DOS_HEADER __ImageBase; /* Reloc safe! */
30 30
 
31 31
 BOOL init() {
32 32
     char whereami[PATH_MAX], *slash;