Commit 33c8ffc3 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Added helper to define the module's name.

parent a85895d2
...@@ -447,6 +447,8 @@ extern enum module_type ...@@ -447,6 +447,8 @@ extern enum module_type
extern void module_reset_debug_info(struct module* module); extern void module_reset_debug_info(struct module* module);
extern BOOL module_remove(struct process* pcs, extern BOOL module_remove(struct process* pcs,
struct module* module); struct module* module);
extern void module_set_module(struct module* module, const char* name);
/* msc.c */ /* msc.c */
extern BOOL pe_load_debug_directory(const struct process* pcs, extern BOOL pe_load_debug_directory(const struct process* pcs,
struct module* module, struct module* module,
......
...@@ -79,6 +79,11 @@ static void module_fill_module(const char* in, char* out, size_t size) ...@@ -79,6 +79,11 @@ static void module_fill_module(const char* in, char* out, size_t size)
while ((*out = tolower(*out))) out++; 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) static const char* get_module_type(enum module_type type, BOOL virtual)
{ {
switch (type) switch (type)
...@@ -116,8 +121,7 @@ struct module* module_new(struct process* pcs, const char* name, ...@@ -116,8 +121,7 @@ struct module* module_new(struct process* pcs, const char* name,
module->module.SizeOfStruct = sizeof(module->module); module->module.SizeOfStruct = sizeof(module->module);
module->module.BaseOfImage = mod_addr; module->module.BaseOfImage = mod_addr;
module->module.ImageSize = size; module->module.ImageSize = size;
module_fill_module(name, module->module.ModuleName, module_set_module(module, name);
sizeof(module->module.ModuleName));
module->module.ImageName[0] = '\0'; module->module.ImageName[0] = '\0';
lstrcpynA(module->module.LoadedImageName, name, sizeof(module->module.LoadedImageName)); lstrcpynA(module->module.LoadedImageName, name, sizeof(module->module.LoadedImageName));
module->module.SymType = SymNone; module->module.SymType = SymNone;
...@@ -423,7 +427,7 @@ done: ...@@ -423,7 +427,7 @@ done:
* of ImageName. Overwrite it, if we have better information * of ImageName. Overwrite it, if we have better information
*/ */
if (ModuleName) 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)); lstrcpynA(module->module.ImageName, ImageName, sizeof(module->module.ImageName));
return module->module.BaseOfImage; return module->module.BaseOfImage;
...@@ -453,7 +457,7 @@ DWORD64 WINAPI SymLoadModuleEx(HANDLE hProcess, HANDLE hFile, PCSTR ImageName, ...@@ -453,7 +457,7 @@ DWORD64 WINAPI SymLoadModuleEx(HANDLE hProcess, HANDLE hFile, PCSTR ImageName,
(DWORD)BaseOfDll, DllSize, 0, 0); (DWORD)BaseOfDll, DllSize, 0, 0);
if (!module) return FALSE; if (!module) return FALSE;
if (ModuleName) if (ModuleName)
lstrcpynA(module->module.ModuleName, ModuleName, sizeof(module->module.ModuleName)); module_set_module(module, ModuleName);
module->module.SymType = SymVirtual; module->module.SymType = SymVirtual;
return TRUE; return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment