Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/dbghelp/module.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 9f90d5e..64dbd5a 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -75,9 +75,16 @@ static const WCHAR* get_filename(const WCHAR* name, const WCHAR* endptr) return ++ptr; }
+static BOOL is_wine_loader(const WCHAR *module) +{ + static const WCHAR wineW[] = {'w','i','n','e',0}; + static const WCHAR wine64W[] = {'w','i','n','e','6','4',0}; + const WCHAR *filename = get_filename(module, NULL); + return !strcmpW(filename, wineW) || !strcmpW(filename, wine64W); +} + static void module_fill_module(const WCHAR* in, WCHAR* out, size_t size) { - const WCHAR *loader = get_wine_loader_name(); const WCHAR *ptr, *endptr; size_t len, l;
@@ -87,7 +94,7 @@ static void module_fill_module(const WCHAR* in, WCHAR* out, size_t size) out[len] = '\0'; if (len > 4 && (l = match_ext(out, len))) out[len - l] = '\0'; - else if (len > strlenW(loader) && !strcmpiW(out + len - strlenW(loader), loader)) + else if (is_wine_loader(out)) lstrcpynW(out, S_WineLoaderW, size); else { @@ -455,8 +462,7 @@ static BOOL module_is_container_loaded(const struct process* pcs, */ enum module_type module_get_type_by_name(const WCHAR* name) { - int loader_len, len = strlenW(name); - const WCHAR *loader; + int len = strlenW(name);
/* Skip all version extensions (.[digits]) regex: "(.\d+)*$" */ do @@ -491,10 +497,7 @@ enum module_type module_get_type_by_name(const WCHAR* name) return DMT_DBG;
/* wine is also a native module (Mach-O on Mac OS X, ELF elsewhere) */ - loader = get_wine_loader_name(); - loader_len = strlenW( loader ); - if ((len == loader_len || (len > loader_len && name[len - loader_len - 1] == '/')) && - !strcmpiW(name + len - loader_len, loader)) + if (is_wine_loader(name)) { #ifdef __APPLE__ return DMT_MACHO;