从一些书中,我知道dbgeng.dll是调试器的调试引擎,它导出了许多用于调试的方法。
但是使用depends时,我发现在dbgeng.dll中只导出了3个函数(如下所示),那么像windbg.exe/cdb.exe这样的调试器如何使用dbgeng.dll
DebugConnect
DebugConnectWide
DebugCreate发布于 2010-09-14 03:38:18
下载WinDBG并查看SDK示例,特别是dumpstk示例,它展示了如何打开崩溃转储文件并打印调用堆栈。曾傑瑞的描述是正确的,你可以调用DebugCreate来创建一个IDebugClient的实例,然后从那里你可以创建其他类的实例来进行调试相关的活动。
从示例中:
void
CreateInterfaces(void)
{
HRESULT Status;
// Start things off by getting an initial interface from
// the engine. This can be any engine interface but is
// generally IDebugClient as the client interface is
// where sessions are started.
if ((Status = DebugCreate(__uuidof(IDebugClient),
(void**)&g_Client)) != S_OK)
{
Exit(1, "DebugCreate failed, 0x%X\n", Status);
}
// Query for some other interfaces that we'll need.
if ((Status = g_Client->QueryInterface(__uuidof(IDebugControl),
(void**)&g_Control)) != S_OK ||
(Status = g_Client->QueryInterface(__uuidof(IDebugSymbols),
(void**)&g_Symbols)) != S_OK)
{
Exit(1, "QueryInterface failed, 0x%X\n", Status);
}
}-scott
发布于 2010-09-14 01:05:48
我还没有详细研究过这个特定的接口,但是有相当多的DLL的工作原理大致类似。DebugCreate最有可能返回(?的地址)某种对象,它拥有执行实际调试所需的所有调用(但您需要知道哪个函数的地址位于什么偏移量,以及在您可以真正使用它之前将哪些参数加载到何处)。
可以把它看作是COM对象的一种模拟,但是只有一个预定义的接口,而不是几个能够动态查找和使用接口的接口。
https://stackoverflow.com/questions/3702629
复制相似问题