dbghelp: Lookup real image paths in image_locate_debug_link.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Jacek Caban 2020-03-17 17:22:07 +01:00 committed by Alexandre Julliard
parent 2642f43eab
commit 838de56e0a
1 changed files with 11 additions and 0 deletions

View File

@ -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));