|
|
|
@ -42,17 +42,6 @@ BOOL init() { |
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
|
|
slash++; |
|
|
|
|
*slash='\0'; |
|
|
|
|
SetDllDirectory(whereami); |
|
|
|
|
__try { |
|
|
|
|
cl_set_clcb_msg(msg_callback); |
|
|
|
|
ret = cl_init(CL_INIT_DEFAULT); |
|
|
|
|
} |
|
|
|
|
__except(EXCEPTION_EXECUTE_HANDLER) { ret = 1; } |
|
|
|
|
|
|
|
|
|
SetDllDirectory(NULL); |
|
|
|
|
if(ret) |
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
|
|
strncpy(slash, "clamav_log_verbose", sizeof(whereami) - (slash - whereami)); |
|
|
|
|
whereami[sizeof(whereami)-1] = '\0'; |
|
|
|
@ -69,18 +58,34 @@ BOOL init() { |
|
|
|
|
return FALSE; |
|
|
|
|
strncpy(slash, "clamav.old.log", sizeof(whereami) - (slash - whereami)); |
|
|
|
|
whereami[sizeof(whereami)-1] = '\0'; |
|
|
|
|
|
|
|
|
|
if(!MoveFileEx(logg_file, whereami, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH)) |
|
|
|
|
DeleteFile(logg_file); |
|
|
|
|
logg_noflush = 1;/* only flush on errors and warnings */ |
|
|
|
|
if(logg("ClamAV core initialized (version %s, flevel %d)\n", cl_retver(), cl_retflevel())) |
|
|
|
|
if(logg("ClamAV module initializing\n")<0) |
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
|
|
*slash='\0'; |
|
|
|
|
SetDllDirectory(whereami); |
|
|
|
|
__try { |
|
|
|
|
cl_set_clcb_msg(msg_callback); |
|
|
|
|
ret = cl_init(CL_INIT_DEFAULT); |
|
|
|
|
} |
|
|
|
|
__except(EXCEPTION_EXECUTE_HANDLER) { ret = -1; } |
|
|
|
|
|
|
|
|
|
SetDllDirectory(NULL); |
|
|
|
|
if(ret) { |
|
|
|
|
logg("!Failed to init ClamAV engine (%d)\n", ret); |
|
|
|
|
return FALSE; |
|
|
|
|
} |
|
|
|
|
logg("ClamAV core initialized (version %s, flevel %d)\n", cl_retver(), cl_retflevel()); |
|
|
|
|
|
|
|
|
|
if(init_errors()) { |
|
|
|
|
logg("!Failed to initialize errors\n"); |
|
|
|
|
return FALSE; |
|
|
|
|
} |
|
|
|
|
ret = interface_setup(); |
|
|
|
|
logg("ClamAV module %s\n", ret == TRUE ? "initialized" : "failed! Aborting..."); |
|
|
|
|
logg("ClamAV module initialization %s\n", ret == TRUE ? "succeded" : "failed! Aborting..."); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -100,14 +105,16 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser |
|
|
|
|
// Can't use logg(), or logg_close() here because pthreads
|
|
|
|
|
// may have already been shut down, and pthread_mutex_lock would
|
|
|
|
|
// deadlock
|
|
|
|
|
if (engine) { |
|
|
|
|
if (uninitialize_called) |
|
|
|
|
fprintf(logg_fp, "Engine still active during detach!\n"); |
|
|
|
|
else |
|
|
|
|
fprintf(logg_fp, "Scan_Uninitialize not called, but process is terminating\n"); |
|
|
|
|
if(logg_fp) { |
|
|
|
|
if (engine) { |
|
|
|
|
if (uninitialize_called) |
|
|
|
|
fprintf(logg_fp, "Engine still active during detach!\n"); |
|
|
|
|
else |
|
|
|
|
fprintf(logg_fp, "Scan_Uninitialize not called, but process is terminating\n"); |
|
|
|
|
} |
|
|
|
|
fprintf(logg_fp, "ClamAV module shutting down\n"); |
|
|
|
|
fclose(logg_fp); |
|
|
|
|
} |
|
|
|
|
fprintf(logg_fp, "ClamAV module shutting down\n"); |
|
|
|
|
fclose(logg_fp); |
|
|
|
|
} |
|
|
|
|
return TRUE; |
|
|
|
|
} |
|
|
|
|