From 838de56e0ac5b91e2ffa27a696d33e0f09179b2e Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 17 Mar 2020 17:22:07 +0100 Subject: [PATCH] dbghelp: Lookup real image paths in image_locate_debug_link. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/dbghelp/module.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 9c8fb662f09..0a90595b8c1 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -606,6 +606,7 @@ static BOOL image_locate_debug_link(const struct module* module, struct image_fi filename_len = MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, NULL, 0); path_len = strlenW(module->module.LoadedImageName); + if (module->real_path) path_len = max(path_len, strlenW(module->real_path)); p = HeapAlloc(GetProcessHeap(), 0, (globalDebugDirLen + path_len + 6 + 1 + filename_len + 1) * sizeof(WCHAR)); if (!p) goto found; @@ -625,6 +626,16 @@ static BOOL image_locate_debug_link(const struct module* module, struct image_fi MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, slash + ARRAY_SIZE(dotDebugW), filename_len); if (image_check_debug_link(p, fmap_link, crc)) goto found; + if (module->real_path) + { + strcpyW(p, module->real_path); + slash = p; + if ((slash2 = strrchrW(slash, '/'))) slash = slash2 + 1; + if ((slash2 = strrchrW(slash, '\\'))) slash = slash2 + 1; + MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, slash, filename_len); + if (image_check_debug_link(p, fmap_link, crc)) goto found; + } + /* testing globaldebugdir/execdir/filename */ memmove(p + globalDebugDirLen, p, (slash - p) * sizeof(WCHAR)); memcpy(p, globalDebugDirW, globalDebugDirLen * sizeof(WCHAR));