From 8d37842072657f214926906df17f7f184d60e1ee Mon Sep 17 00:00:00 2001 From: Kevin Lin Date: Wed, 13 Jul 2016 16:26:58 -0400 Subject: [PATCH] win32: fixes for sigtool imphash linking --- libclamav/pe.c | 8 ++++---- sigtool/sigtool.c | 2 -- win32/libclamav.def | 1 + 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libclamav/pe.c b/libclamav/pe.c index 3cf3c9d9c..49b49e0cc 100644 --- a/libclamav/pe.c +++ b/libclamav/pe.c @@ -238,8 +238,8 @@ struct pe_image_import_descriptor { uint32_t FirstThunk; }; -#define IMAGE_ORDINAL_FLAG32 0x80000000 -#define IMAGE_ORDINAL_FLAG64 0x8000000000000000L +#define PE_IMAGEDIR_ORDINAL_FLAG32 0x80000000 +#define PE_IMAGEDIR_ORDINAL_FLAG64 0x8000000000000000L struct pe_image_thunk32 { union { @@ -2301,7 +2301,7 @@ static inline int hash_impfns(cli_ctx *ctx, void **hashctx, uint32_t *impsz, str thunk32.u.Ordinal = EC32(thunk32.u.Ordinal); - if (!(thunk32.u.Ordinal & IMAGE_ORDINAL_FLAG32)) { + if (!(thunk32.u.Ordinal & PE_IMAGEDIR_ORDINAL_FLAG32)) { offset = cli_rawaddr(thunk32.u.Function, exe_sections, nsections, &err, fsize, hdr_size); if (offset >= 0) { @@ -2337,7 +2337,7 @@ static inline int hash_impfns(cli_ctx *ctx, void **hashctx, uint32_t *impsz, str thunk64.u.Ordinal = EC64(thunk64.u.Ordinal); - if (!(thunk64.u.Ordinal & IMAGE_ORDINAL_FLAG64)) { + if (!(thunk64.u.Ordinal & PE_IMAGEDIR_ORDINAL_FLAG64)) { offset = cli_rawaddr(thunk64.u.Function, exe_sections, nsections, &err, fsize, hdr_size); if (offset >= 0) { diff --git a/sigtool/sigtool.c b/sigtool/sigtool.c index 49c771828..e4d876652 100644 --- a/sigtool/sigtool.c +++ b/sigtool/sigtool.c @@ -252,8 +252,6 @@ static int hashpe(const char *filename, unsigned int class, int type) return -1; } - cli_debug_flag = 0; - /* THIS MAY BE UNNECESSARY */ switch(ret) { case CL_CLEAN: diff --git a/win32/libclamav.def b/win32/libclamav.def index 29cd2305b..ceecbba7f 100644 --- a/win32/libclamav.def +++ b/win32/libclamav.def @@ -178,6 +178,7 @@ EXPORTS cli_ldbtokenize @44380 NONAME EXPORTS cli_hwp5header @44381 NONAME EXPORTS cli_scanhwp5_stream @44382 NONAME EXPORTS cli_scanhwp3 @44383 NONAME +EXPORTS cli_genhash_pe @44384 NONAME ; compatibility layer, tommath, zlib EXPORTS w32_srand @44269 NONAME