From f71124fa11fd3476892f447e5172c92a76321ba4 Mon Sep 17 00:00:00 2001 From: winesync Date: Fri, 11 Sep 2020 17:05:16 +0200 Subject: [PATCH] [WINESYNC] dbghelp: Support Windows paths in elf_locate_debug_link. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard wine commit id e1b28a9c988ef0ff49d7254fd7ba05316f1c9b98 by Jacek Caban --- dll/win32/dbghelp/elf_module.c | 11 +++++++---- sdk/tools/winesync/dbghelp.cfg | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c index e0ae195cd89..0d190e549cd 100644 --- a/dll/win32/dbghelp/elf_module.c +++ b/dll/win32/dbghelp/elf_module.c @@ -1010,23 +1010,26 @@ static BOOL elf_locate_debug_link(struct image_file_map* fmap, const char* filen static const WCHAR globalDebugDirW[] = {'/','u','s','r','/','l','i','b','/','d','e','b','u','g','/'}; static const WCHAR dotDebugW[] = {'.','d','e','b','u','g','/'}; const size_t globalDebugDirLen = ARRAY_SIZE(globalDebugDirW); - size_t filename_len; + size_t filename_len, path_len; WCHAR* p = NULL; WCHAR* slash; + WCHAR* slash2; struct image_file_map* fmap_link = NULL; fmap_link = HeapAlloc(GetProcessHeap(), 0, sizeof(*fmap_link)); if (!fmap_link) return FALSE; filename_len = MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, NULL, 0); + path_len = strlenW(loaded_file); p = HeapAlloc(GetProcessHeap(), 0, - (globalDebugDirLen + strlenW(loaded_file) + 6 + 1 + filename_len + 1) * sizeof(WCHAR)); + (globalDebugDirLen + path_len + 6 + 1 + filename_len + 1) * sizeof(WCHAR)); if (!p) goto found; /* we prebuild the string with "execdir" */ strcpyW(p, loaded_file); - slash = strrchrW(p, '/'); - if (slash == NULL) slash = p; else slash++; + slash = p; + if ((slash2 = strrchrW(slash, '/'))) slash = slash2 + 1; + if ((slash2 = strrchrW(slash, '\\'))) slash = slash2 + 1; /* testing execdir/filename */ MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, slash, filename_len); diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg index 3a1ee0fa5aa..63f6c9fd2db 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: a5a6b0dcb65d8e3576e34d350c80f4789dcfdb7a + wine: e1b28a9c988ef0ff49d7254fd7ba05316f1c9b98