Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dbgeng/dbgeng.c | 19 ++++++++++++++++--- include/dbgeng.h | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/dlls/dbgeng/dbgeng.c b/dlls/dbgeng/dbgeng.c index 287e0d84f7..569b824e1d 100644 --- a/dlls/dbgeng/dbgeng.c +++ b/dlls/dbgeng/dbgeng.c @@ -2525,11 +2525,24 @@ static HRESULT STDMETHODCALLTYPE debugcontrol_OutputStackTrace(IDebugControl2 *i return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE debugcontrol_GetDebuggeeType(IDebugControl2 *iface, ULONG *_class, ULONG *qualifier) +static HRESULT STDMETHODCALLTYPE debugcontrol_GetDebuggeeType(IDebugControl2 *iface, ULONG *debug_class, + ULONG *qualifier) { - FIXME("%p, %p, %p stub.\n", iface, _class, qualifier); + struct debug_client *debug_client = impl_from_IDebugControl2(iface); + static struct target_process *target;
- return E_NOTIMPL; + FIXME("%p, %p, %p stub.\n", iface, debug_class, qualifier); + + *debug_class = DEBUG_CLASS_UNINITIALIZED; + *qualifier = 0; + + if (!(target = debug_client_get_target(debug_client))) + return E_UNEXPECTED; + + *debug_class = DEBUG_CLASS_USER_WINDOWS; + *qualifier = DEBUG_USER_WINDOWS_PROCESS; + + return S_OK; }
static HRESULT STDMETHODCALLTYPE debugcontrol_GetActualProcessorType(IDebugControl2 *iface, ULONG *type) diff --git a/include/dbgeng.h b/include/dbgeng.h index 3017edac55..0c97d2c9a7 100644 --- a/include/dbgeng.h +++ b/include/dbgeng.h @@ -169,6 +169,27 @@ DEFINE_GUID(IID_IDebugSystemObjects3, 0xe9676e2f, 0xe286, 0x4ea3, 0xb0, 0xf9 #define DEBUG_MODNAME_SYMBOL_FILE 3 #define DEBUG_MODNAME_MAPPED_IMAGE 4
+#define DEBUG_CLASS_UNINITIALIZED 0 +#define DEBUG_CLASS_KERNEL 1 +#define DEBUG_CLASS_USER_WINDOWS 2 +#define DEBUG_CLASS_IMAGE_FILE 3 + +#define DEBUG_DUMP_SMALL 1024 +#define DEBUG_DUMP_DEFAULT 1025 +#define DEBUG_DUMP_FULL 1026 +#define DEBUG_DUMP_IMAGE_FILE 1027 +#define DEBUG_DUMP_TRACE_LOG 1028 +#define DEBUG_DUMP_WINDOWS_CE 1029 +#define DEBUG_DUMP_ACTIVE 1030 + +#define DEBUG_USER_WINDOWS_PROCESS 0 +#define DEBUG_USER_WINDOWS_PROCESS_SERVER 1 +#define DEBUG_USER_WINDOWS_IDNA 2 +#define DEBUG_USER_WINDOWS_REPT 3 +#define DEBUG_USER_WINDOWS_SMALL_DUMP DEBUG_DUMP_SMALL +#define DEBUG_USER_WINDOWS_DUMP DEBUG_DUMP_DEFAULT +#define DEBUG_USER_WINDOWS_DUMP_WINDOWS_CE DEBUG_DUMP_WINDOWS_CE + #define DEBUG_INVALID_OFFSET ((ULONG64)-1) #define DEBUG_ANY_ID 0xffffffff
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dbgeng/dbgeng.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/dbgeng/dbgeng.c b/dlls/dbgeng/dbgeng.c index 569b824e1d..95a95b6896 100644 --- a/dlls/dbgeng/dbgeng.c +++ b/dlls/dbgeng/dbgeng.c @@ -108,13 +108,28 @@ static WORD debug_target_get_module_machine(struct target_process *target, HMODU ReadProcessMemory(target->handle, module, &dos, sizeof(dos), NULL); if (dos.e_magic == IMAGE_DOS_SIGNATURE) { - ReadProcessMemory(target->handle, (const char *)module + dos.e_lfanew + 4 /* signature */, &machine, + ReadProcessMemory(target->handle, (const char *)module + dos.e_lfanew + 4 /* PE signature */, &machine, sizeof(machine), NULL); }
return machine; }
+static DWORD debug_target_get_module_timestamp(struct target_process *target, HMODULE module) +{ + IMAGE_DOS_HEADER dos = { 0 }; + DWORD timestamp = 0; + + ReadProcessMemory(target->handle, module, &dos, sizeof(dos), NULL); + if (dos.e_magic == IMAGE_DOS_SIGNATURE) + { + ReadProcessMemory(target->handle, (const char *)module + dos.e_lfanew + 4 /* PE signature */ + + FIELD_OFFSET(IMAGE_FILE_HEADER, TimeDateStamp), ×tamp, sizeof(timestamp), NULL); + } + + return timestamp; +} + static HRESULT debug_target_init_modules_info(struct target_process *target) { unsigned int i, count; @@ -156,6 +171,7 @@ static HRESULT debug_target_init_modules_info(struct target_process *target)
target->modules.info[i].params.Base = (ULONG_PTR)info.lpBaseOfDll; target->modules.info[i].params.Size = info.SizeOfImage; + target->modules.info[i].params.TimeDateStamp = debug_target_get_module_timestamp(target, modules[i]);
GetModuleFileNameExA(target->handle, modules[i], target->modules.info[i].image_name, ARRAY_SIZE(target->modules.info[i].image_name));
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dbgeng/dbgeng.c | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
diff --git a/dlls/dbgeng/dbgeng.c b/dlls/dbgeng/dbgeng.c index 95a95b6896..b62e4ad772 100644 --- a/dlls/dbgeng/dbgeng.c +++ b/dlls/dbgeng/dbgeng.c @@ -67,6 +67,7 @@ struct debug_client IDebugDataSpaces IDebugDataSpaces_iface; IDebugSymbols3 IDebugSymbols3_iface; IDebugControl2 IDebugControl2_iface; + IDebugAdvanced IDebugAdvanced_iface; LONG refcount; ULONG engine_options; struct list targets; @@ -259,6 +260,11 @@ static struct debug_client *impl_from_IDebugControl2(IDebugControl2 *iface) return CONTAINING_RECORD(iface, struct debug_client, IDebugControl2_iface); }
+static struct debug_client *impl_from_IDebugAdvanced(IDebugAdvanced *iface) +{ + return CONTAINING_RECORD(iface, struct debug_client, IDebugAdvanced_iface); +} + static HRESULT STDMETHODCALLTYPE debugclient_QueryInterface(IDebugClient *iface, REFIID riid, void **obj) { struct debug_client *debug_client = impl_from_IDebugClient(iface); @@ -285,6 +291,10 @@ static HRESULT STDMETHODCALLTYPE debugclient_QueryInterface(IDebugClient *iface, { *obj = &debug_client->IDebugControl2_iface; } + else if (IsEqualIID(riid, &IID_IDebugAdvanced)) + { + *obj = &debug_client->IDebugAdvanced_iface; + } else { WARN("Unsupported interface %s.\n", debugstr_guid(riid)); @@ -3289,6 +3299,53 @@ static const IDebugControl2Vtbl debugcontrolvtbl = debugcontrol_OutputTextReplacements, };
+static HRESULT STDMETHODCALLTYPE debugadvanced_QueryInterface(IDebugAdvanced *iface, REFIID riid, void **obj) +{ + struct debug_client *debug_client = impl_from_IDebugAdvanced(iface); + IUnknown *unk = (IUnknown *)&debug_client->IDebugClient_iface; + return IUnknown_QueryInterface(unk, riid, obj); +} + +static ULONG STDMETHODCALLTYPE debugadvanced_AddRef(IDebugAdvanced *iface) +{ + struct debug_client *debug_client = impl_from_IDebugAdvanced(iface); + IUnknown *unk = (IUnknown *)&debug_client->IDebugClient_iface; + return IUnknown_AddRef(unk); +} + +static ULONG STDMETHODCALLTYPE debugadvanced_Release(IDebugAdvanced *iface) +{ + struct debug_client *debug_client = impl_from_IDebugAdvanced(iface); + IUnknown *unk = (IUnknown *)&debug_client->IDebugClient_iface; + return IUnknown_Release(unk); +} + +static HRESULT STDMETHODCALLTYPE debugadvanced_GetThreadContext(IDebugAdvanced *iface, void *context, + ULONG context_size) +{ + FIXME("%p, %p, %u stub.\n", iface, context, context_size); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugadvanced_SetThreadContext(IDebugAdvanced *iface, void *context, + ULONG context_size) +{ + FIXME("%p, %p, %u stub.\n", iface, context, context_size); + + return E_NOTIMPL; +} + +static const IDebugAdvancedVtbl debugadvancedvtbl = +{ + debugadvanced_QueryInterface, + debugadvanced_AddRef, + debugadvanced_Release, + /* IDebugAdvanced */ + debugadvanced_GetThreadContext, + debugadvanced_SetThreadContext, +}; + /************************************************************ * DebugExtensionInitialize (DBGENG.@) * @@ -3333,6 +3390,7 @@ HRESULT WINAPI DebugCreate(REFIID riid, void **obj) debug_client->IDebugDataSpaces_iface.lpVtbl = &debugdataspacesvtbl; debug_client->IDebugSymbols3_iface.lpVtbl = &debugsymbolsvtbl; debug_client->IDebugControl2_iface.lpVtbl = &debugcontrolvtbl; + debug_client->IDebugAdvanced_iface.lpVtbl = &debugadvancedvtbl; debug_client->refcount = 1; list_init(&debug_client->targets);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dbgeng/dbgeng.c | 280 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+)
diff --git a/dlls/dbgeng/dbgeng.c b/dlls/dbgeng/dbgeng.c index b62e4ad772..9fcce32607 100644 --- a/dlls/dbgeng/dbgeng.c +++ b/dlls/dbgeng/dbgeng.c @@ -68,6 +68,7 @@ struct debug_client IDebugSymbols3 IDebugSymbols3_iface; IDebugControl2 IDebugControl2_iface; IDebugAdvanced IDebugAdvanced_iface; + IDebugSystemObjects IDebugSystemObjects_iface; LONG refcount; ULONG engine_options; struct list targets; @@ -265,6 +266,11 @@ static struct debug_client *impl_from_IDebugAdvanced(IDebugAdvanced *iface) return CONTAINING_RECORD(iface, struct debug_client, IDebugAdvanced_iface); }
+static struct debug_client *impl_from_IDebugSystemObjects(IDebugSystemObjects *iface) +{ + return CONTAINING_RECORD(iface, struct debug_client, IDebugSystemObjects_iface); +} + static HRESULT STDMETHODCALLTYPE debugclient_QueryInterface(IDebugClient *iface, REFIID riid, void **obj) { struct debug_client *debug_client = impl_from_IDebugClient(iface); @@ -295,6 +301,10 @@ static HRESULT STDMETHODCALLTYPE debugclient_QueryInterface(IDebugClient *iface, { *obj = &debug_client->IDebugAdvanced_iface; } + else if (IsEqualIID(riid, &IID_IDebugSystemObjects)) + { + *obj = &debug_client->IDebugSystemObjects_iface; + } else { WARN("Unsupported interface %s.\n", debugstr_guid(riid)); @@ -3346,6 +3356,275 @@ static const IDebugAdvancedVtbl debugadvancedvtbl = debugadvanced_SetThreadContext, };
+ +static HRESULT STDMETHODCALLTYPE debugsystemobjects_QueryInterface(IDebugSystemObjects *iface, REFIID riid, void **obj) +{ + struct debug_client *debug_client = impl_from_IDebugSystemObjects(iface); + IUnknown *unk = (IUnknown *)&debug_client->IDebugClient_iface; + return IUnknown_QueryInterface(unk, riid, obj); +} + +static ULONG STDMETHODCALLTYPE debugsystemobjects_AddRef(IDebugSystemObjects *iface) +{ + struct debug_client *debug_client = impl_from_IDebugSystemObjects(iface); + IUnknown *unk = (IUnknown *)&debug_client->IDebugClient_iface; + return IUnknown_AddRef(unk); +} + +static ULONG STDMETHODCALLTYPE debugsystemobjects_Release(IDebugSystemObjects *iface) +{ + struct debug_client *debug_client = impl_from_IDebugSystemObjects(iface); + IUnknown *unk = (IUnknown *)&debug_client->IDebugClient_iface; + return IUnknown_Release(unk); +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetEventThread(IDebugSystemObjects *iface, ULONG *id) +{ + FIXME("%p, %p stub.\n", iface, id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetEventProcess(IDebugSystemObjects *iface, ULONG *id) +{ + FIXME("%p, %p stub.\n", iface, id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetCurrentThreadId(IDebugSystemObjects *iface, ULONG *id) +{ + FIXME("%p, %p stub.\n", iface, id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_SetCurrentThreadId(IDebugSystemObjects *iface, ULONG id) +{ + FIXME("%p, %u stub.\n", iface, id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_SetCurrentProcessId(IDebugSystemObjects *iface, ULONG id) +{ + FIXME("%p, %u stub.\n", iface, id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetNumberThreads(IDebugSystemObjects *iface, ULONG *number) +{ + FIXME("%p, %p stub.\n", iface, number); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetTotalNumberThreads(IDebugSystemObjects *iface, ULONG *total, + ULONG *largest_process) +{ + FIXME("%p, %p, %p stub.\n", iface, total, largest_process); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetThreadIdsByIndex(IDebugSystemObjects *iface, ULONG start, + ULONG count, ULONG *ids, ULONG *sysids) +{ + FIXME("%p, %u, %u, %p, %p stub.\n", iface, start, count, ids, sysids); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetThreadIdByProcessor(IDebugSystemObjects *iface, ULONG processor, + ULONG *id) +{ + FIXME("%p, %u, %p stub.\n", iface, processor, id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetCurrentThreadDataOffset(IDebugSystemObjects *iface, + ULONG64 *offset) +{ + FIXME("%p, %p stub.\n", iface, offset); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetThreadIdByDataOffset(IDebugSystemObjects *iface, ULONG64 offset, + ULONG *id) +{ + FIXME("%p, %s, %p stub.\n", iface, wine_dbgstr_longlong(offset), id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetCurrentThreadTeb(IDebugSystemObjects *iface, ULONG64 *offset) +{ + FIXME("%p, %p stub.\n", iface, offset); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetThreadIdByTeb(IDebugSystemObjects *iface, ULONG64 offset, + ULONG *id) +{ + FIXME("%p, %s, %p stub.\n", iface, wine_dbgstr_longlong(offset), id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetCurrentThreadSystemId(IDebugSystemObjects *iface, ULONG *sysid) +{ + FIXME("%p, %p stub.\n", iface, sysid); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetThreadIdBySystemId(IDebugSystemObjects *iface, ULONG sysid, + ULONG *id) +{ + FIXME("%p, %u, %p stub.\n", iface, sysid, id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetCurrentThreadHandle(IDebugSystemObjects *iface, ULONG64 *handle) +{ + FIXME("%p, %p stub.\n", iface, handle); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetThreadIdByHandle(IDebugSystemObjects *iface, ULONG64 handle, + ULONG *id) +{ + FIXME("%p, %s, %p stub.\n", iface, wine_dbgstr_longlong(handle), id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetNumberProcesses(IDebugSystemObjects *iface, ULONG *number) +{ + FIXME("%p, %p stub.\n", iface, number); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetProcessIdsByIndex(IDebugSystemObjects *iface, ULONG start, + ULONG count, ULONG *ids, ULONG *sysids) +{ + FIXME("%p, %u, %u, %p, %p stub.\n", iface, start, count, ids, sysids); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetCurrentProcessDataOffset(IDebugSystemObjects *iface, + ULONG64 *offset) +{ + FIXME("%p, %p stub.\n", iface, offset); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetProcessIdByDataOffset(IDebugSystemObjects *iface, + ULONG64 offset, ULONG *id) +{ + FIXME("%p, %s, %p stub.\n", iface, wine_dbgstr_longlong(offset), id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetCurrentProcessPeb(IDebugSystemObjects *iface, ULONG64 *offset) +{ + FIXME("%p, %p stub.\n", iface, offset); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetProcessIdByPeb(IDebugSystemObjects *iface, ULONG64 offset, + ULONG *id) +{ + FIXME("%p, %s, %p stub.\n", iface, wine_dbgstr_longlong(offset), id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetCurrentProcessSystemId(IDebugSystemObjects *iface, ULONG *sysid) +{ + FIXME("%p, %p stub.\n", iface, sysid); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetProcessIdBySystemId(IDebugSystemObjects *iface, ULONG sysid, + ULONG *id) +{ + FIXME("%p, %u, %p stub.\n", iface, sysid, id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetCurrentProcessHandle(IDebugSystemObjects *iface, + ULONG64 *handle) +{ + FIXME("%p, %p stub.\n", iface, handle); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetProcessIdByHandle(IDebugSystemObjects *iface, ULONG64 handle, + ULONG *id) +{ + FIXME("%p, %s, %p stub.\n", iface, wine_dbgstr_longlong(handle), id); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE debugsystemobjects_GetCurrentProcessExecutableName(IDebugSystemObjects *iface, + char *buffer, ULONG buffer_size, ULONG *exe_size) +{ + FIXME("%p, %p, %u, %p stub.\n", iface, buffer, buffer_size, exe_size); + + return E_NOTIMPL; +} + +static const IDebugSystemObjectsVtbl debugsystemobjectsvtbl = +{ + debugsystemobjects_QueryInterface, + debugsystemobjects_AddRef, + debugsystemobjects_Release, + debugsystemobjects_GetEventThread, + debugsystemobjects_GetEventProcess, + debugsystemobjects_GetCurrentThreadId, + debugsystemobjects_SetCurrentThreadId, + debugsystemobjects_SetCurrentProcessId, + debugsystemobjects_GetNumberThreads, + debugsystemobjects_GetTotalNumberThreads, + debugsystemobjects_GetThreadIdsByIndex, + debugsystemobjects_GetThreadIdByProcessor, + debugsystemobjects_GetCurrentThreadDataOffset, + debugsystemobjects_GetThreadIdByDataOffset, + debugsystemobjects_GetCurrentThreadTeb, + debugsystemobjects_GetThreadIdByTeb, + debugsystemobjects_GetCurrentThreadSystemId, + debugsystemobjects_GetThreadIdBySystemId, + debugsystemobjects_GetCurrentThreadHandle, + debugsystemobjects_GetThreadIdByHandle, + debugsystemobjects_GetNumberProcesses, + debugsystemobjects_GetProcessIdsByIndex, + debugsystemobjects_GetCurrentProcessDataOffset, + debugsystemobjects_GetProcessIdByDataOffset, + debugsystemobjects_GetCurrentProcessPeb, + debugsystemobjects_GetProcessIdByPeb, + debugsystemobjects_GetCurrentProcessSystemId, + debugsystemobjects_GetProcessIdBySystemId, + debugsystemobjects_GetCurrentProcessHandle, + debugsystemobjects_GetProcessIdByHandle, + debugsystemobjects_GetCurrentProcessExecutableName, +}; + /************************************************************ * DebugExtensionInitialize (DBGENG.@) * @@ -3391,6 +3670,7 @@ HRESULT WINAPI DebugCreate(REFIID riid, void **obj) debug_client->IDebugSymbols3_iface.lpVtbl = &debugsymbolsvtbl; debug_client->IDebugControl2_iface.lpVtbl = &debugcontrolvtbl; debug_client->IDebugAdvanced_iface.lpVtbl = &debugadvancedvtbl; + debug_client->IDebugSystemObjects_iface.lpVtbl = &debugsystemobjectsvtbl; debug_client->refcount = 1; list_init(&debug_client->targets);