是的,您需要服务器正在运行的 dbgeng.dll 版本
通常在服务器和客户端安装相同的windbg版本并从客户端windbg安装文件夹运行应用程序将起作用
或者您可以将dbgeng复制到exe所在的本地文件夹
复制 c:\prograxxxxxx\dbgeng.dll 。到可执行文件的目录
这是一个示例流程
执行 DebugConnect() 的代码(DebugConectWide 的 Ascii 版本)
#include <stdio.h>
#include <dbgeng.h>
#pragma comment(lib, "dbgeng.lib")
int main(int argc, char *argv[])
{
if (argc == 2)
{
IDebugClient *dbgclient = NULL;
HRESULT hr = E_FAIL;
hr = DebugConnect(argv[1], __uuidof(IDebugClient), (VOID **)&dbgclient);
if (hr == S_OK && dbgclient != NULL)
{
ULONG mask = 0xdeadbeef;
hr = dbgclient->GetOutputMask(&mask);
if (hr == S_OK && mask != 0xdeadbeef)
{
printf("Outputmask = %x\n", mask);
}
printf("hresult = %x\tmask = %x\n", hr, mask);
}
printf("hresult = %x\tdbgclient = %p\n", hr, dbgclient);
}
else
{
printf("usage %s remote connection string", argv[0]);
}
return 0;
}
在 x64 中编译为 x64 在 win10 1803 中使用 vs2017 社区开发 cmdprompt 使用
cl /Zi /W4 /analyze /Od /EHsc /nologo concliw.cpp /link /release
在本地机器上运行的命令行参数中包含 cdb 的进程列表
server debuggee client and wmic commandlines
C:\>whoami
kr\xxxxx
C:\>wmic process get CommandLine /format:list | grep -i cdb
CommandLine=cdb -server npipe:pipe=windpipe cdb
CommandLine=cdb
CommandLine=cdb -remote npipe:server=KR,pipe=windpipe
CommandLine=grep -i cdb
复制正确的 dbgeng.dll 并将其重命名为 test_dbgeng.dll
copy "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbgeng.dll" .
ren dbgeng.dll test_dbgeng.dll
执行重命名为 dbgeng.dll 的二进制文件并重新执行二进制文件
concliw.exe
usage concliw.exe remote connection string
concliw.exe "npipe:server=KR,pipe=windpipe"
hresult = 8007053d dbgclient = 0000000000000000
ren test_dbgeng.dll dbgeng.dll
concliw.exe "npipe:server=KR,pipe=windpipe"
Outputmask = 3f7
hresult = 0 mask = 3f7
hresult = 0 dbgclient = 000001FA6B9D2590