mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 10:21:50 +00:00
[WINESYNC] dbghelp: Use file_name helper in more places.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 77e880e6d22ef9be031f783fbb4b6a5e8c8826e8 by Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
parent
eaa0c1a8d7
commit
981f24bd1a
6 changed files with 19 additions and 28 deletions
|
@ -703,6 +703,8 @@ extern BOOL path_find_symbol_file(const struct process* pcs, const struc
|
|||
PCSTR full_path, const GUID* guid, DWORD dw1, DWORD dw2,
|
||||
WCHAR *buffer, BOOL* is_unmatched) DECLSPEC_HIDDEN;
|
||||
extern WCHAR *get_dos_file_name(const WCHAR *filename) DECLSPEC_HIDDEN;
|
||||
extern const WCHAR* file_name(const WCHAR* str) DECLSPEC_HIDDEN;
|
||||
extern const char* file_nameA(const char* str) DECLSPEC_HIDDEN;
|
||||
|
||||
/* pe_module.c */
|
||||
extern BOOL pe_load_nt_header(HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS* nth) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -727,8 +727,7 @@ static const Elf64_Sym *elf_lookup_symtab(const struct module* module,
|
|||
{
|
||||
compiland_name = source_get(module,
|
||||
((const struct symt_compiland*)compiland)->source);
|
||||
compiland_basename = strrchr(compiland_name, '/');
|
||||
if (!compiland_basename++) compiland_basename = compiland_name;
|
||||
compiland_basename = file_nameA(compiland_name);
|
||||
}
|
||||
else compiland_name = compiland_basename = NULL;
|
||||
|
||||
|
@ -745,8 +744,7 @@ static const Elf64_Sym *elf_lookup_symtab(const struct module* module,
|
|||
const char* filename = source_get(module, ste->compiland->source);
|
||||
if (strcmp(filename, compiland_name))
|
||||
{
|
||||
base = strrchr(filename, '/');
|
||||
if (!base++) base = filename;
|
||||
base = file_nameA(filename);
|
||||
if (strcmp(base, compiland_basename)) continue;
|
||||
}
|
||||
}
|
||||
|
@ -1434,7 +1432,7 @@ static BOOL elf_search_and_load_file(struct process* pcs, const WCHAR* filename,
|
|||
if (strstrW(filename, S_libstdcPPW)) return FALSE; /* We know we can't do it */
|
||||
ret = elf_load_file(pcs, filename, load_offset, dyn_addr, elf_info);
|
||||
/* if relative pathname, try some absolute base dirs */
|
||||
if (!ret && !strchrW(filename, '/'))
|
||||
if (!ret && filename == file_name(filename))
|
||||
{
|
||||
ret = elf_load_file_from_path(pcs, filename, load_offset, dyn_addr,
|
||||
getenv("PATH"), elf_info) ||
|
||||
|
@ -1689,8 +1687,7 @@ static BOOL elf_load_cb(const WCHAR* name, unsigned long load_addr,
|
|||
/* memcmp is needed for matches when bufstr contains also version information
|
||||
* el->name: libc.so, name: libc.so.6.0
|
||||
*/
|
||||
p = strrchrW(name, '/');
|
||||
if (!p++) p = name;
|
||||
p = file_name(name);
|
||||
}
|
||||
|
||||
if (!el->name || !memcmp(p, el->name, lstrlenW(el->name) * sizeof(WCHAR)))
|
||||
|
@ -1724,8 +1721,7 @@ struct module* elf_load_module(struct process* pcs, const WCHAR* name, unsigned
|
|||
/* do only the lookup from the filename, not the path (as we lookup module
|
||||
* name in the process' loaded module list)
|
||||
*/
|
||||
el.name = strrchrW(name, '/');
|
||||
if (!el.name++) el.name = name;
|
||||
el.name = file_name(name);
|
||||
el.ret = FALSE;
|
||||
|
||||
if (!elf_enum_modules_internal(pcs, NULL, elf_load_cb, &el))
|
||||
|
|
|
@ -1193,10 +1193,7 @@ static void find_and_map_dsym(struct process *pcs, struct module* module)
|
|||
if (!fmap->uuid)
|
||||
return;
|
||||
|
||||
if ((p = strrchrW(module->module.LoadedImageName, '/')))
|
||||
p++;
|
||||
else
|
||||
p = module->module.LoadedImageName;
|
||||
p = file_name(module->module.LoadedImageName);
|
||||
len = strlenW(module->module.LoadedImageName) + strlenW(dot_dsym) + strlenW(dsym_subpath) + strlenW(p) + 1;
|
||||
path = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
if (!path)
|
||||
|
@ -1637,19 +1634,17 @@ static BOOL macho_search_and_load_file(struct process* pcs, const WCHAR* filenam
|
|||
if (strstrW(filename, S_libstdcPPW)) return FALSE; /* We know we can't do it */
|
||||
|
||||
/* If has no directories, try PATH first. */
|
||||
if (!strchrW(filename, '/'))
|
||||
p = file_name(filename);
|
||||
if (p == filename)
|
||||
{
|
||||
ret = macho_load_file_from_path(pcs, filename, load_addr,
|
||||
getenv("PATH"), macho_info);
|
||||
}
|
||||
/* Try DYLD_LIBRARY_PATH, with just the filename (no directories). */
|
||||
if (!ret)
|
||||
{
|
||||
if ((p = strrchrW(filename, '/'))) p++;
|
||||
else p = filename;
|
||||
ret = macho_load_file_from_path(pcs, p, load_addr,
|
||||
getenv("DYLD_LIBRARY_PATH"), macho_info);
|
||||
}
|
||||
|
||||
/* Try the path as given. */
|
||||
if (!ret)
|
||||
ret = macho_load_file(pcs, filename, load_addr, macho_info);
|
||||
|
@ -1661,7 +1656,7 @@ static BOOL macho_search_and_load_file(struct process* pcs, const WCHAR* filenam
|
|||
fallback = "/usr/local/lib:/lib:/usr/lib";
|
||||
ret = macho_load_file_from_path(pcs, p, load_addr, fallback, macho_info);
|
||||
}
|
||||
if (!ret && !strchrW(filename, '/'))
|
||||
if (!ret && p == filename)
|
||||
ret = macho_load_file_from_dll_path(pcs, filename, load_addr, macho_info);
|
||||
|
||||
return ret;
|
||||
|
@ -1957,8 +1952,7 @@ static BOOL macho_load_cb(const WCHAR* name, unsigned long addr, void* user)
|
|||
/* memcmp is needed for matches when bufstr contains also version information
|
||||
* ml->name: libc.so, name: libc.so.6.0
|
||||
*/
|
||||
p = strrchrW(name, '/');
|
||||
if (!p++) p = name;
|
||||
p = file_name(name);
|
||||
if (!memcmp(p, ml->name, lstrlenW(ml->name) * sizeof(WCHAR)))
|
||||
{
|
||||
ml->ret = macho_search_and_load_file(ml->pcs, name, addr, &ml->macho_info);
|
||||
|
@ -1989,8 +1983,7 @@ struct module* macho_load_module(struct process* pcs, const WCHAR* name, unsign
|
|||
/* do only the lookup from the filename, not the path (as we lookup module
|
||||
* name in the process' loaded module list)
|
||||
*/
|
||||
ml.name = strrchrW(name, '/');
|
||||
if (!ml.name++) ml.name = name;
|
||||
ml.name = file_name(name);
|
||||
ml.ret = FALSE;
|
||||
|
||||
if (!macho_enum_modules_internal(pcs, NULL, macho_load_cb, &ml))
|
||||
|
|
|
@ -87,14 +87,14 @@ static BOOL is_wine_loader(const WCHAR *module)
|
|||
static const WCHAR wineW[] = {'w','i','n','e',0};
|
||||
static const WCHAR suffixW[] = {'6','4',0};
|
||||
const WCHAR *filename = get_filename(module, NULL);
|
||||
const char *ptr, *p;
|
||||
const char *ptr;
|
||||
BOOL ret = FALSE;
|
||||
WCHAR *buffer;
|
||||
DWORD len;
|
||||
|
||||
if ((ptr = getenv("WINELOADER")))
|
||||
{
|
||||
if ((p = strrchr(ptr, '/'))) ptr = p + 1;
|
||||
ptr = file_nameA(ptr);
|
||||
len = 2 + MultiByteToWideChar( CP_UNIXCP, 0, ptr, -1, NULL, 0 );
|
||||
buffer = heap_alloc( len * sizeof(WCHAR) );
|
||||
MultiByteToWideChar( CP_UNIXCP, 0, ptr, -1, buffer, len );
|
||||
|
|
|
@ -34,7 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
|
|||
static inline BOOL is_sepA(char ch) {return ch == '/' || ch == '\\';}
|
||||
static inline BOOL is_sep(WCHAR ch) {return ch == '/' || ch == '\\';}
|
||||
|
||||
static inline const char* file_nameA(const char* str)
|
||||
const char* file_nameA(const char* str)
|
||||
{
|
||||
const char* p;
|
||||
|
||||
|
@ -42,7 +42,7 @@ static inline const char* file_nameA(const char* str)
|
|||
return p + 1;
|
||||
}
|
||||
|
||||
static inline const WCHAR* file_name(const WCHAR* str)
|
||||
const WCHAR* file_name(const WCHAR* str)
|
||||
{
|
||||
const WCHAR* p;
|
||||
|
||||
|
|
|
@ -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: 63d41a41f21c4d9f32b484d6c7ed78c9d7b2a48d
|
||||
wine: 77e880e6d22ef9be031f783fbb4b6a5e8c8826e8
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue