Commit f1436139 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Rewrote SymEnumerateModules with Unicode basis, and implemented SymEnumerateModulesW64.

parent 851197f8
......@@ -46,7 +46,7 @@
@ stdcall SymEnumTypesW(ptr double ptr ptr)
@ stdcall SymEnumerateModules(long ptr ptr)
@ stdcall SymEnumerateModules64(long ptr ptr)
@ stub SymEnumerateModulesW64
@ stdcall SymEnumerateModulesW64(long ptr ptr)
@ stdcall SymEnumerateSymbols(long long ptr ptr)
@ stub SymEnumerateSymbols64
@ stub SymEnumerateSymbolsW
......
......@@ -632,34 +632,72 @@ BOOL WINAPI SymUnloadModule64(HANDLE hProcess, DWORD64 BaseOfDll)
* SymEnumerateModules (DBGHELP.@)
*
*/
struct enum_modW64_32
{
PSYM_ENUMMODULES_CALLBACK cb;
PVOID user;
char module[MAX_PATH];
};
static BOOL CALLBACK enum_modW64_32(PWSTR name, DWORD64 base, PVOID user)
{
struct enum_modW64_32* x = user;
WideCharToMultiByte(CP_ACP, 0, name, -1, x->module, sizeof(x->module), NULL, NULL);
return x->cb(x->module, (DWORD)base, x->user);
}
BOOL WINAPI SymEnumerateModules(HANDLE hProcess,
PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,
PVOID UserContext)
{
struct process* pcs = process_find_by_handle(hProcess);
struct module* module;
struct enum_modW64_32 x;
if (!pcs) return FALSE;
for (module = pcs->lmodules; module; module = module->next)
{
if (!(dbghelp_options & SYMOPT_WINE_WITH_ELF_MODULES) && module->type == DMT_ELF)
continue;
if (!EnumModulesCallback(module->module_name,
module->module.BaseOfImage, UserContext))
break;
}
return TRUE;
x.cb = EnumModulesCallback;
x.user = UserContext;
return SymEnumerateModulesW64(hProcess, enum_modW64_32, &x);
}
/******************************************************************
* SymEnumerateModules64 (DBGHELP.@)
*
*/
struct enum_modW64_64
{
PSYM_ENUMMODULES_CALLBACK64 cb;
PVOID user;
char module[MAX_PATH];
};
static BOOL CALLBACK enum_modW64_64(PWSTR name, DWORD64 base, PVOID user)
{
struct enum_modW64_64* x = user;
WideCharToMultiByte(CP_ACP, 0, name, -1, x->module, sizeof(x->module), NULL, NULL);
return x->cb(x->module, base, x->user);
}
BOOL WINAPI SymEnumerateModules64(HANDLE hProcess,
PSYM_ENUMMODULES_CALLBACK64 EnumModulesCallback,
PVOID UserContext)
{
struct enum_modW64_64 x;
x.cb = EnumModulesCallback;
x.user = UserContext;
return SymEnumerateModulesW64(hProcess, enum_modW64_64, &x);
}
/******************************************************************
* SymEnumerateModulesW64 (DBGHELP.@)
*
*/
BOOL WINAPI SymEnumerateModulesW64(HANDLE hProcess,
PSYM_ENUMMODULES_CALLBACKW64 EnumModulesCallback,
PVOID UserContext)
{
struct process* pcs = process_find_by_handle(hProcess);
struct module* module;
......@@ -669,7 +707,7 @@ BOOL WINAPI SymEnumerateModules64(HANDLE hProcess,
{
if (!(dbghelp_options & SYMOPT_WINE_WITH_ELF_MODULES) && module->type == DMT_ELF)
continue;
if (!EnumModulesCallback(module->module_name,
if (!EnumModulesCallback(module->module.ModuleName,
module->module.BaseOfImage, UserContext))
break;
}
......
......@@ -764,6 +764,8 @@ typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR, ULONG, PVOID);
BOOL WINAPI SymEnumerateModules(HANDLE, PSYM_ENUMMODULES_CALLBACK, PVOID);
typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(PSTR, DWORD64, PVOID);
BOOL WINAPI SymEnumerateModules64(HANDLE, PSYM_ENUMMODULES_CALLBACK64, PVOID);
typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACKW64)(PWSTR, DWORD64, PVOID);
BOOL WINAPI SymEnumerateModulesW64(HANDLE, PSYM_ENUMMODULES_CALLBACKW64, PVOID);
BOOL WINAPI SymGetModuleInfo(HANDLE, DWORD, PIMAGEHLP_MODULE);
BOOL WINAPI SymGetModuleInfoW(HANDLE, DWORD, PIMAGEHLP_MODULEW);
BOOL WINAPI SymGetModuleInfo64(HANDLE, DWORD64, PIMAGEHLP_MODULE64);
......
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