mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:53:40 +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,
|
PCSTR full_path, const GUID* guid, DWORD dw1, DWORD dw2,
|
||||||
WCHAR *buffer, BOOL* is_unmatched) DECLSPEC_HIDDEN;
|
WCHAR *buffer, BOOL* is_unmatched) DECLSPEC_HIDDEN;
|
||||||
extern WCHAR *get_dos_file_name(const WCHAR *filename) 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 */
|
/* pe_module.c */
|
||||||
extern BOOL pe_load_nt_header(HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS* nth) DECLSPEC_HIDDEN;
|
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,
|
compiland_name = source_get(module,
|
||||||
((const struct symt_compiland*)compiland)->source);
|
((const struct symt_compiland*)compiland)->source);
|
||||||
compiland_basename = strrchr(compiland_name, '/');
|
compiland_basename = file_nameA(compiland_name);
|
||||||
if (!compiland_basename++) compiland_basename = compiland_name;
|
|
||||||
}
|
}
|
||||||
else compiland_name = compiland_basename = NULL;
|
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);
|
const char* filename = source_get(module, ste->compiland->source);
|
||||||
if (strcmp(filename, compiland_name))
|
if (strcmp(filename, compiland_name))
|
||||||
{
|
{
|
||||||
base = strrchr(filename, '/');
|
base = file_nameA(filename);
|
||||||
if (!base++) base = filename;
|
|
||||||
if (strcmp(base, compiland_basename)) continue;
|
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 */
|
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);
|
ret = elf_load_file(pcs, filename, load_offset, dyn_addr, elf_info);
|
||||||
/* if relative pathname, try some absolute base dirs */
|
/* 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,
|
ret = elf_load_file_from_path(pcs, filename, load_offset, dyn_addr,
|
||||||
getenv("PATH"), elf_info) ||
|
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
|
/* memcmp is needed for matches when bufstr contains also version information
|
||||||
* el->name: libc.so, name: libc.so.6.0
|
* el->name: libc.so, name: libc.so.6.0
|
||||||
*/
|
*/
|
||||||
p = strrchrW(name, '/');
|
p = file_name(name);
|
||||||
if (!p++) p = name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!el->name || !memcmp(p, el->name, lstrlenW(el->name) * sizeof(WCHAR)))
|
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
|
/* do only the lookup from the filename, not the path (as we lookup module
|
||||||
* name in the process' loaded module list)
|
* name in the process' loaded module list)
|
||||||
*/
|
*/
|
||||||
el.name = strrchrW(name, '/');
|
el.name = file_name(name);
|
||||||
if (!el.name++) el.name = name;
|
|
||||||
el.ret = FALSE;
|
el.ret = FALSE;
|
||||||
|
|
||||||
if (!elf_enum_modules_internal(pcs, NULL, elf_load_cb, &el))
|
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)
|
if (!fmap->uuid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((p = strrchrW(module->module.LoadedImageName, '/')))
|
p = file_name(module->module.LoadedImageName);
|
||||||
p++;
|
|
||||||
else
|
|
||||||
p = module->module.LoadedImageName;
|
|
||||||
len = strlenW(module->module.LoadedImageName) + strlenW(dot_dsym) + strlenW(dsym_subpath) + strlenW(p) + 1;
|
len = strlenW(module->module.LoadedImageName) + strlenW(dot_dsym) + strlenW(dsym_subpath) + strlenW(p) + 1;
|
||||||
path = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
path = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||||
if (!path)
|
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 (strstrW(filename, S_libstdcPPW)) return FALSE; /* We know we can't do it */
|
||||||
|
|
||||||
/* If has no directories, try PATH first. */
|
/* 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,
|
ret = macho_load_file_from_path(pcs, filename, load_addr,
|
||||||
getenv("PATH"), macho_info);
|
getenv("PATH"), macho_info);
|
||||||
}
|
}
|
||||||
/* Try DYLD_LIBRARY_PATH, with just the filename (no directories). */
|
/* Try DYLD_LIBRARY_PATH, with just the filename (no directories). */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
|
||||||
if ((p = strrchrW(filename, '/'))) p++;
|
|
||||||
else p = filename;
|
|
||||||
ret = macho_load_file_from_path(pcs, p, load_addr,
|
ret = macho_load_file_from_path(pcs, p, load_addr,
|
||||||
getenv("DYLD_LIBRARY_PATH"), macho_info);
|
getenv("DYLD_LIBRARY_PATH"), macho_info);
|
||||||
}
|
|
||||||
/* Try the path as given. */
|
/* Try the path as given. */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = macho_load_file(pcs, filename, load_addr, macho_info);
|
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";
|
fallback = "/usr/local/lib:/lib:/usr/lib";
|
||||||
ret = macho_load_file_from_path(pcs, p, load_addr, fallback, macho_info);
|
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);
|
ret = macho_load_file_from_dll_path(pcs, filename, load_addr, macho_info);
|
||||||
|
|
||||||
return ret;
|
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
|
/* memcmp is needed for matches when bufstr contains also version information
|
||||||
* ml->name: libc.so, name: libc.so.6.0
|
* ml->name: libc.so, name: libc.so.6.0
|
||||||
*/
|
*/
|
||||||
p = strrchrW(name, '/');
|
p = file_name(name);
|
||||||
if (!p++) p = name;
|
|
||||||
if (!memcmp(p, ml->name, lstrlenW(ml->name) * sizeof(WCHAR)))
|
if (!memcmp(p, ml->name, lstrlenW(ml->name) * sizeof(WCHAR)))
|
||||||
{
|
{
|
||||||
ml->ret = macho_search_and_load_file(ml->pcs, name, addr, &ml->macho_info);
|
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
|
/* do only the lookup from the filename, not the path (as we lookup module
|
||||||
* name in the process' loaded module list)
|
* name in the process' loaded module list)
|
||||||
*/
|
*/
|
||||||
ml.name = strrchrW(name, '/');
|
ml.name = file_name(name);
|
||||||
if (!ml.name++) ml.name = name;
|
|
||||||
ml.ret = FALSE;
|
ml.ret = FALSE;
|
||||||
|
|
||||||
if (!macho_enum_modules_internal(pcs, NULL, macho_load_cb, &ml))
|
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 wineW[] = {'w','i','n','e',0};
|
||||||
static const WCHAR suffixW[] = {'6','4',0};
|
static const WCHAR suffixW[] = {'6','4',0};
|
||||||
const WCHAR *filename = get_filename(module, NULL);
|
const WCHAR *filename = get_filename(module, NULL);
|
||||||
const char *ptr, *p;
|
const char *ptr;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
WCHAR *buffer;
|
WCHAR *buffer;
|
||||||
DWORD len;
|
DWORD len;
|
||||||
|
|
||||||
if ((ptr = getenv("WINELOADER")))
|
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 );
|
len = 2 + MultiByteToWideChar( CP_UNIXCP, 0, ptr, -1, NULL, 0 );
|
||||||
buffer = heap_alloc( len * sizeof(WCHAR) );
|
buffer = heap_alloc( len * sizeof(WCHAR) );
|
||||||
MultiByteToWideChar( CP_UNIXCP, 0, ptr, -1, buffer, len );
|
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_sepA(char ch) {return ch == '/' || ch == '\\';}
|
||||||
static inline BOOL is_sep(WCHAR 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;
|
const char* p;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ static inline const char* file_nameA(const char* str)
|
||||||
return p + 1;
|
return p + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const WCHAR* file_name(const WCHAR* str)
|
const WCHAR* file_name(const WCHAR* str)
|
||||||
{
|
{
|
||||||
const WCHAR* p;
|
const WCHAR* p;
|
||||||
|
|
||||||
|
|
|
@ -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: 63d41a41f21c4d9f32b484d6c7ed78c9d7b2a48d
|
wine: 77e880e6d22ef9be031f783fbb4b6a5e8c8826e8
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue