https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f9b46d2c9f105614e2d34a4f1a395bd88379aa2a

commit f9b46d2c9f105614e2d34a4f1a395bd88379aa2a
Author:     winesync <[email protected]>
AuthorDate: Fri Sep 11 17:14:18 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Sep 16 10:35:48 2020 +0200

    [WINESYNC] dbghelp: Don't use elf_fetch_file_info and macho_fetch_file_info 
in module_find_cb.
    
    Signed-off-by: Jacek Caban <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id adecdb1d01487af16f5f708ae92a05ba4707187e by Jacek Caban 
<[email protected]>
---
 dll/win32/dbghelp/path.c       | 45 +++++++++++++++++++-----------------------
 sdk/tools/winesync/dbghelp.cfg |  2 +-
 2 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/dll/win32/dbghelp/path.c b/dll/win32/dbghelp/path.c
index a5b8b4fdd8d..023adfa1037 100644
--- a/dll/win32/dbghelp/path.c
+++ b/dll/win32/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:
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index 59039add5d6..528e63fee11 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -4,4 +4,4 @@ files:
   include/dbghelp.h: sdk/include/psdk/dbghelp.h
   include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
 tags:
-  wine: fec0157585e9d8bd03a8a71d1ed9b9d7ca59cb56
+  wine: adecdb1d01487af16f5f708ae92a05ba4707187e

Reply via email to