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

This commit is contained in:
Eric Pouech 2007-02-21 21:54:33 +01:00 committed by Alexandre Julliard
parent a85895d240
commit 33c8ffc301
2 changed files with 10 additions and 4 deletions

View File

@ -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,

View File

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