Visual Studio:抑制每个DLL的调试输出 [英] Visual Studio: suppress debug output per DLL

查看:125
本文介绍了Visual Studio:抑制每个DLL的调试输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以抑制第三方DLL的详细调试输出?我的调试输出窗口被淹没了。我不能修改有问题的DLL。

Is it possible to suppress the verbose debug output from a third-party DLL? My debug output window is flooded with them. I can't modify the DLL in question.

推荐答案

我不认为有任何简单的方法来做到这一点。

I don't think that there are any simple way to do this.

一种方式将以 API-hooking (或函数挂接)的任何方式工作。有不同的方式可以做到这一点。

One way will work in any way is API-hooking (or function hooking). There are different way how one can do this.

如果你想拒绝调试输出的DLL导出 OutputDebugString 功能直接(使用 dumpbin / import thedll.dll )可以修补PE导入地址表 IMAGE_THUNK_DATA )的内存中的DLL指向您的虚拟函数的引用,不做任何事情。

If the DLL where you want to deny debug output import OutputDebugString function directly (use dumpbin /imports thedll.dll) one can patch PE import address table (IMAGE_THUNK_DATA) of the DLL in memory to point the reference to your dummy function which do nothing.

如果您不知道第三个使用哪个API你可以使用代码重写技术,以便您的进程的内存中的 OutputDebugString 函数的代码将被更改(JMP或CALL指令),以便您的函数将被调用,您的代码可以检查调用堆栈,如果第三方DLL在里面,您将无法执行任何操作。如果您没有在调用堆栈上找到第三方DLL,则可以将调用转发到 OutputDebugString 的原始实现。

If you don't know exactly which API are used by the third-party DLL you can use code overwriting technique so that the code of OutputDebugString function in the memory of your process will be changed (JMP or CALL instruction) so that your function will be called, your code can examine the call stack and if the third-party DLL are inside you can do nothing. In case that you don't find the third-party DLL on the call stack you can forward the call to original implementation of OutputDebugString.

两种描述的技术都用于DLL注入。在您的情况下,您有更容易的情况,因为您需要在自己的过程中进行更改,因此不需要特殊的用户权限。

Both of the describes techniques are used in DLL-Injection. In your case you have more easy case because you need to do the changes in your own process, so no special user rights are required.

所有描述的技术并不简单就像我在答复开始时所写的那样。我在答复开始时写道,我不认为有任何简单的方法存在。另一方面,您不需要自己实现上述所有内容。您可以通过许多计算机语言在互联网上找到足够的代码示例。

All the described technique are not simple like I wrote at the beginning of my answer. I wrote at the beginning of my answer that I don't think that any simple way exist. On the other side you don't need to implement all which described above yourself. You can find enough code example in the internet in many computer languages.

这篇关于Visual Studio:抑制每个DLL的调试输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆