mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 23:45:42 +00:00
[WINESYNC] dbghelp: Use search_dll_path in elf_search_and_load_file.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id ee5d29b7aa85c109bf9ad5ac59fbe484f53da0ea by Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
parent
e01d28abd8
commit
bf9bb9c911
2 changed files with 22 additions and 39 deletions
|
@ -38,7 +38,6 @@
|
||||||
|
|
||||||
#include "image_private.h"
|
#include "image_private.h"
|
||||||
|
|
||||||
#include "wine/library.h"
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/heap.h"
|
#include "wine/heap.h"
|
||||||
|
|
||||||
|
@ -1261,6 +1260,20 @@ static BOOL elf_load_file(struct process* pcs, const WCHAR* filename,
|
||||||
return ret;
|
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
|
* elf_load_file_from_path
|
||||||
* tries to load an ELF file from a set of paths (separated by ':')
|
* 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;
|
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
|
#ifdef AT_SYSINFO_EHDR
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* elf_search_auxv
|
* 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 relative pathname, try some absolute base dirs */
|
||||||
if (!ret && filename == file_name(filename))
|
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,
|
ret = elf_load_file_from_path(pcs, filename, load_offset, dyn_addr,
|
||||||
getenv("PATH"), elf_info) ||
|
getenv("PATH"), elf_info) ||
|
||||||
elf_load_file_from_path(pcs, filename, load_offset, dyn_addr,
|
elf_load_file_from_path(pcs, filename, load_offset, dyn_addr,
|
||||||
getenv("LD_LIBRARY_PATH"), elf_info);
|
getenv("LD_LIBRARY_PATH"), elf_info);
|
||||||
if (!ret) ret = elf_load_file_from_dll_path(pcs, filename,
|
if (!ret) ret = search_dll_path(filename, elf_load_file_cb, &load_elf);
|
||||||
load_offset, dyn_addr, elf_info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -4,4 +4,4 @@ files:
|
||||||
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
||||||
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
|
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
|
||||||
tags:
|
tags:
|
||||||
wine: 21af2e194792aaa263c144c8fb42fe678ad2ecd7
|
wine: ee5d29b7aa85c109bf9ad5ac59fbe484f53da0ea
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue