|
|
|
@ -1024,10 +1024,13 @@ int CLAMAPI Scan_ScanObjectByHandle(CClamAVScanner *pScanner, HANDLE object, int |
|
|
|
|
int CLAMAPI Scan_GetFileType(HANDLE hFile, _int64 *filetype) { |
|
|
|
|
instance *inst; |
|
|
|
|
int status, ret = Scan_CreateInstance((CClamAVScanner **)&inst); |
|
|
|
|
if(ret != CLAMAPI_SUCCESS) |
|
|
|
|
return ret; |
|
|
|
|
logg("*in Scan_GetFileType(HANDLE = %x, filetype = %p)\n", hFile, filetype); |
|
|
|
|
if(ret != CLAMAPI_SUCCESS) { |
|
|
|
|
FAIL(ret, "Failed to create instance, error %d", ret); |
|
|
|
|
} |
|
|
|
|
inst->filetype = filetype; |
|
|
|
|
ret = Scan_ScanObjectByHandle((CClamAVScanner *)inst, hFile, &status, NULL); |
|
|
|
|
logg("Scan_GetFileType: Scan_ScanObjectByHandle returned %d, type %016llx%016llx\n", ret, filetype[1], filetype[0]); |
|
|
|
|
Scan_DestroyInstance((CClamAVScanner *)inst); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
@ -1056,7 +1059,7 @@ int CLAMAPI Scan_DeleteScanInfo(CClamAVScanner *pScanner, PCLAM_SCAN_INFO_LIST p |
|
|
|
|
|
|
|
|
|
static void ftype_bits(const char *type, _int64 *filetype) { |
|
|
|
|
int i; |
|
|
|
|
if(strncmp(type, "CL_TYPE_", 8)) { |
|
|
|
|
if(!strncmp(type, "CL_TYPE_", 8)) { |
|
|
|
|
for(i=0; types[i]; i++) { |
|
|
|
|
if(!strcmp(&type[8], types[i])) |
|
|
|
|
break; |
|
|
|
@ -1074,12 +1077,14 @@ static void ftype_bits(const char *type, _int64 *filetype) { |
|
|
|
|
filetype[0] = 0; |
|
|
|
|
filetype[1] = 1LL << (i-64); |
|
|
|
|
} |
|
|
|
|
logg("*ftype_bits setting type to %016llx%016llx\n", filetype[1], filetype[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cl_error_t filetype_cb(int fd, const char *type, void *context) { |
|
|
|
|
struct scan_ctx *sctx = (struct scan_ctx *)context; |
|
|
|
|
if(sctx && sctx->inst && sctx->inst->filetype) { |
|
|
|
|
ftype_bits(type, sctx->inst->filetype); |
|
|
|
|
logg("*in filetype_cb with clamav context %p, instance %p, fd %d, type %s, typenum %016llx%016llx)\n", context, sctx->inst, fd, type, sctx->inst->filetype[1], sctx->inst->filetype[0]); |
|
|
|
|
return CL_BREAK; |
|
|
|
|
} |
|
|
|
|
return CL_CLEAN; |
|
|
|
|