https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bf9bb9c911cc91b343a39…
commit bf9bb9c911cc91b343a3928007b37a1443fb1500
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Fri Sep 11 17:10:41 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Sep 16 10:35:47 2020 +0200
[WINESYNC] dbghelp: Use search_dll_path in elf_search_and_load_file.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id ee5d29b7aa85c109bf9ad5ac59fbe484f53da0ea by Jacek Caban
<jacek(a)codeweavers.com>
---
dll/win32/dbghelp/elf_module.c | 59 +++++++++++++++---------------------------
sdk/tools/winesync/dbghelp.cfg | 2 +-
2 files changed, 22 insertions(+), 39 deletions(-)
diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c
index 34fffdae5bd..0433bf77e05 100644
--- a/dll/win32/dbghelp/elf_module.c
+++ b/dll/win32/dbghelp/elf_module.c
@@ -38,7 +38,6 @@
#include "image_private.h"
-#include "wine/library.h"
#include "wine/debug.h"
#include "wine/heap.h"
@@ -1261,6 +1260,20 @@ static BOOL elf_load_file(struct process* pcs, const WCHAR*
filename,
return ret;
}
+struct elf_load_file_params
+{
+ struct process *process;
+ ULONG_PTR load_offset;
+ ULONG_PTR dyn_addr;
+ struct elf_info *elf_info;
+};
+
+static BOOL elf_load_file_cb(void *param, HANDLE handle, const WCHAR *filename)
+{
+ struct elf_load_file_params *load_file = param;
+ return elf_load_file(load_file->process, filename, load_file->load_offset,
load_file->dyn_addr, load_file->elf_info);
+}
+
/******************************************************************
* elf_load_file_from_path
* tries to load an ELF file from a set of paths (separated by ':')
@@ -1302,41 +1315,6 @@ static BOOL elf_load_file_from_path(HANDLE hProcess,
return ret;
}
-/******************************************************************
- * elf_load_file_from_dll_path
- *
- * Tries to load an ELF file from the dll path
- */
-static BOOL elf_load_file_from_dll_path(HANDLE hProcess,
- const WCHAR* filename,
- unsigned long load_offset,
- unsigned long dyn_addr,
- struct elf_info* elf_info)
-{
- BOOL ret = FALSE;
- unsigned int index = 0;
- const char *path;
-
- while (!ret && (path = wine_dll_enum_load_path( index++ )))
- {
- WCHAR *name;
- unsigned len;
-
- len = MultiByteToWideChar(CP_UNIXCP, 0, path, -1, NULL, 0);
-
- name = HeapAlloc( GetProcessHeap(), 0,
- (len + lstrlenW(filename) + 2) * sizeof(WCHAR) );
-
- if (!name) break;
- MultiByteToWideChar(CP_UNIXCP, 0, path, -1, name, len);
- strcatW( name, S_SlashW );
- strcatW( name, filename );
- ret = elf_load_file(hProcess, name, load_offset, dyn_addr, elf_info);
- HeapFree( GetProcessHeap(), 0, name );
- }
- return ret;
-}
-
#ifdef AT_SYSINFO_EHDR
/******************************************************************
* elf_search_auxv
@@ -1434,12 +1412,17 @@ static BOOL elf_search_and_load_file(struct process* pcs, const
WCHAR* filename,
/* if relative pathname, try some absolute base dirs */
if (!ret && filename == file_name(filename))
{
+ struct elf_load_file_params load_elf;
+ load_elf.process = pcs;
+ load_elf.load_offset = load_offset;
+ load_elf.dyn_addr = dyn_addr;
+ load_elf.elf_info = elf_info;
+
ret = elf_load_file_from_path(pcs, filename, load_offset, dyn_addr,
getenv("PATH"), elf_info) ||
elf_load_file_from_path(pcs, filename, load_offset, dyn_addr,
getenv("LD_LIBRARY_PATH"), elf_info);
- if (!ret) ret = elf_load_file_from_dll_path(pcs, filename,
- load_offset, dyn_addr, elf_info);
+ if (!ret) ret = search_dll_path(filename, elf_load_file_cb, &load_elf);
}
return ret;
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index d0e56271d9c..719150f9ac5 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: 21af2e194792aaa263c144c8fb42fe678ad2ecd7
+ wine: ee5d29b7aa85c109bf9ad5ac59fbe484f53da0ea