Jacek Caban : dbghelp: Support Windows paths in elf_locate_debug_link.
Alexandre Julliard
julliard at winehq.org
Mon Mar 16 16:49:07 CDT 2020
Module: wine
Branch: master
Commit: e1b28a9c988ef0ff49d7254fd7ba05316f1c9b98
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e1b28a9c988ef0ff49d7254fd7ba05316f1c9b98
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Mar 16 16:06:18 2020 +0100
dbghelp: Support Windows paths in elf_locate_debug_link.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dbghelp/elf_module.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index e0ae195cd8..0d190e549c 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/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);
More information about the wine-cvs
mailing list