diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 83c549d59d7..be6b7e675e6 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -447,6 +447,8 @@ extern enum module_type extern void module_reset_debug_info(struct module* module); extern BOOL module_remove(struct process* pcs, struct module* module); +extern void module_set_module(struct module* module, const char* name); + /* msc.c */ extern BOOL pe_load_debug_directory(const struct process* pcs, struct module* module, diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index e7214b3ab20..e63b5769840 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -79,6 +79,11 @@ static void module_fill_module(const char* in, char* out, size_t size) while ((*out = tolower(*out))) out++; } +void module_set_module(struct module* module, const char* name) +{ + module_fill_module(name, module->module.ModuleName, sizeof(module->module.ModuleName)); +} + static const char* get_module_type(enum module_type type, BOOL virtual) { switch (type) @@ -116,8 +121,7 @@ struct module* module_new(struct process* pcs, const char* name, module->module.SizeOfStruct = sizeof(module->module); module->module.BaseOfImage = mod_addr; module->module.ImageSize = size; - module_fill_module(name, module->module.ModuleName, - sizeof(module->module.ModuleName)); + module_set_module(module, name); module->module.ImageName[0] = '\0'; lstrcpynA(module->module.LoadedImageName, name, sizeof(module->module.LoadedImageName)); module->module.SymType = SymNone; @@ -423,7 +427,7 @@ done: * of ImageName. Overwrite it, if we have better information */ if (ModuleName) - lstrcpynA(module->module.ModuleName, ModuleName, sizeof(module->module.ModuleName)); + module_set_module(module, ModuleName); lstrcpynA(module->module.ImageName, ImageName, sizeof(module->module.ImageName)); return module->module.BaseOfImage; @@ -453,7 +457,7 @@ DWORD64 WINAPI SymLoadModuleEx(HANDLE hProcess, HANDLE hFile, PCSTR ImageName, (DWORD)BaseOfDll, DllSize, 0, 0); if (!module) return FALSE; if (ModuleName) - lstrcpynA(module->module.ModuleName, ModuleName, sizeof(module->module.ModuleName)); + module_set_module(module, ModuleName); module->module.SymType = SymVirtual; return TRUE;