dbgeng: Implement GetModuleByOffset().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-04-22 09:42:29 +03:00 committed by Alexandre Julliard
parent d337e7a656
commit 9fb20dda0f
2 changed files with 44 additions and 3 deletions

View File

@ -1053,9 +1053,30 @@ static HRESULT STDMETHODCALLTYPE debugsymbols_GetModuleByModuleName(IDebugSymbol
static HRESULT STDMETHODCALLTYPE debugsymbols_GetModuleByOffset(IDebugSymbols3 *iface, ULONG64 offset,
ULONG start_index, ULONG *index, ULONG64 *base)
{
FIXME("%p, %s, %u, %p, %p stub.\n", iface, wine_dbgstr_longlong(offset), start_index, index, base);
struct debug_client *debug_client = impl_from_IDebugSymbols3(iface);
static struct target_process *target;
const struct module_info *info;
return E_NOTIMPL;
TRACE("%p, %s, %u, %p, %p.\n", iface, wine_dbgstr_longlong(offset), start_index, index, base);
if (!(target = debug_client_get_target(debug_client)))
return E_UNEXPECTED;
while ((info = debug_target_get_module_info(target, start_index)))
{
if (offset >= info->params.Base && offset < info->params.Base + info->params.Size)
{
if (index)
*index = start_index;
if (base)
*base = info->params.Base;
return S_OK;
}
start_index++;
}
return E_INVALIDARG;
}
static HRESULT STDMETHODCALLTYPE debugsymbols_GetModuleNames(IDebugSymbols3 *iface, ULONG index, ULONG64 base,

View File

@ -322,8 +322,8 @@ todo_wine
static void test_module_information(void)
{
static const char *event_name = "dbgeng_test_event";
unsigned int loaded, unloaded, index;
DEBUG_MODULE_PARAMETERS params[2];
unsigned int loaded, unloaded;
PROCESS_INFORMATION info;
IDebugSymbols *symbols;
IDebugControl *control;
@ -372,7 +372,27 @@ static void test_module_information(void)
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!!base, "Unexpected module base.\n");
hr = symbols->lpVtbl->GetModuleByOffset(symbols, 0, 0, &index, &base);
ok(FAILED(hr), "Unexpected hr %#x.\n", hr);
hr = symbols->lpVtbl->GetModuleByOffset(symbols, base, 0, &index, &base);
ok(hr == S_OK, "Failed to get module, hr %#x.\n", hr);
hr = symbols->lpVtbl->GetModuleByOffset(symbols, base, 0, NULL, NULL);
ok(hr == S_OK, "Failed to get module, hr %#x.\n", hr);
hr = symbols->lpVtbl->GetModuleByOffset(symbols, base + 1, 0, NULL, NULL);
ok(hr == S_OK, "Failed to get module, hr %#x.\n", hr);
hr = symbols->lpVtbl->GetModuleByOffset(symbols, base, loaded, NULL, NULL);
ok(FAILED(hr), "Unexpected hr %#x.\n", hr);
/* Parameters. */
base = 0;
hr = symbols->lpVtbl->GetModuleByIndex(symbols, 0, &base);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!!base, "Unexpected module base.\n");
hr = symbols->lpVtbl->GetModuleParameters(symbols, 1, NULL, 0, params);
ok(hr == S_OK, "Failed to get module parameters, hr %#x.\n", hr);
ok(params[0].Base == base, "Unexpected module base.\n");