|
|
|
@ -28,6 +28,8 @@ |
|
|
|
|
#include "clscanapi.h" |
|
|
|
|
#include "interface.h" |
|
|
|
|
|
|
|
|
|
int WINAPI SHCreateDirectoryExA(HWND, LPCTSTR, SECURITY_ATTRIBUTES *); /* cannot include Shlobj.h due to DATADIR collision */ |
|
|
|
|
|
|
|
|
|
#define FMT(s) "!"__FUNCTION__": "s"\n" |
|
|
|
|
#define FAIL(errcode, fmt, ...) do { logg(FMT(fmt), __VA_ARGS__); return (errcode); } while(0) |
|
|
|
|
#define WIN() do { logg("*%s completed successfully\n", __FUNCTION__); return CLAMAPI_SUCCESS; } while(0) |
|
|
|
@ -373,12 +375,9 @@ int CLAMAPI Scan_Initialize(const wchar_t *pEnginesFolder, const wchar_t *pTempR |
|
|
|
|
} |
|
|
|
|
memcpy(&tmpdir[ret+1], "\\clamtmp", 9); |
|
|
|
|
cli_rmdirs(tmpdir); |
|
|
|
|
if(!CreateDirectory(tmpdir, NULL)) { |
|
|
|
|
ret = GetLastError(); |
|
|
|
|
if((DWORD)ret != ERROR_ALREADY_EXISTS) { |
|
|
|
|
free_engine_and_unlock(); |
|
|
|
|
FAIL(CL_ETMPDIR, "Cannot create pTempRoot '%s': error %d", ret); |
|
|
|
|
} |
|
|
|
|
if((ret = SHCreateDirectoryExA(NULL, tmpdir, NULL) != ERROR_SUCCESS) && ret != ERROR_ALREADY_EXISTS) { |
|
|
|
|
free_engine_and_unlock(); |
|
|
|
|
FAIL(CL_ETMPDIR, "Cannot create pTempRoot '%s': error %d", tmpdir, ret); |
|
|
|
|
} |
|
|
|
|
if((ret = cl_engine_set_str(engine, CL_ENGINE_TMPDIR, tmpdir))) { |
|
|
|
|
free_engine_and_unlock(); |
|
|
|
|