Jacek Caban : dbghelp: Don't use elf_fetch_file_info and macho_fetch_file_info in module_find_cb.
Alexandre Julliard
julliard at winehq.org
Tue Mar 24 15:28:16 CDT 2020
Module: wine
Branch: master
Commit: adecdb1d01487af16f5f708ae92a05ba4707187e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=adecdb1d01487af16f5f708ae92a05ba4707187e
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Mar 24 01:54:19 2020 +0100
dbghelp: Don't use elf_fetch_file_info and macho_fetch_file_info in module_find_cb.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dbghelp/path.c | 45 ++++++++++++++++++++-------------------------
1 file changed, 20 insertions(+), 25 deletions(-)
diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c
index 15e5d344e7..55571e6eff 100644
--- a/dlls/dbghelp/path.c
+++ b/dlls/dbghelp/path.c
@@ -24,6 +24,7 @@
#include <string.h>
#include "dbghelp_private.h"
+#include "image_private.h"
#include "winnls.h"
#include "winternl.h"
#include "wine/debug.h"
@@ -523,34 +524,28 @@ static BOOL CALLBACK module_find_cb(PCWSTR buffer, PVOID user)
if (timestamp == mf->dw1 && size == mf->dw2) matched++;
}
break;
- case DMT_ELF:
- if (elf_fetch_file_info(buffer, 0, &size, &checksum))
- {
- matched++;
- if (checksum == mf->dw1) matched++;
- else
- WARN("Found %s, but wrong checksums: %08x %08x\n",
- debugstr_w(buffer), checksum, mf->dw1);
- }
- else
- {
- WARN("Couldn't read %s\n", debugstr_w(buffer));
- return FALSE;
- }
- break;
case DMT_MACHO:
- if (macho_fetch_file_info(NULL, buffer, 0, 0, &size, &checksum))
+ case DMT_ELF:
{
- matched++;
- if (checksum == mf->dw1) matched++;
+ HANDLE file;
+
+ file = CreateFileW(buffer, GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (file == INVALID_HANDLE_VALUE) break;
+
+ checksum = calc_crc32(file);
+ if (checksum == mf->dw1) matched += 2;
else
- WARN("Found %s, but wrong checksums: %08x %08x\n",
- debugstr_w(buffer), checksum, mf->dw1);
- }
- else
- {
- WARN("Couldn't read %s\n", debugstr_w(buffer));
- return FALSE;
+ {
+ struct image_file_map fmap;
+ WARN("Found %s, but wrong checksums: %08x %08x\n", debugstr_w(buffer), checksum, mf->dw1);
+ if (elf_map_handle(file, &fmap)) /* FIXME: validate macho files */
+ {
+ image_unmap_file(&fmap);
+ matched++;
+ }
+ }
+ CloseHandle(file);
}
break;
case DMT_PDB:
More information about the wine-cvs
mailing list