[英]Debugging shell extension in Windows 7
I'm trying to debug shell extension (IContextMenu) in Windows 7 with Visual C++ 2008. I have set DesktopProcess=1 in the registry and set host app to explorer.exe. 我正在尝试使用Visual C ++ 2008在Windows 7中调试shell扩展(IContextMenu)。我在注册表中设置了DesktopProcess = 1并将主机应用程序设置为explorer.exe。 But when I start the debugger, it launches explorer.exe and then detaches from the process.
但是当我启动调试器时,它会启动explorer.exe然后从进程中分离。 DllMain of the shell extension isn't called.
不调用shell扩展的DllMain。
The same code with exactly the same settings launched in debugger without any problems in Windows XP + Visual C++ 2008. 在Windows XP + Visual C ++ 2008中,在调试器中启动的相同代码具有完全相同的设置,没有任何问题。
Any thoughts how to debug the shell extension in Win7? 有任何想法如何在Win7中调试shell扩展?
I've found a nice workflow that I think is the fastest way to rapidly iterate the code-build-test cycle when developing shell extensions. 我发现了一个很好的工作流程,我认为这是在开发shell扩展时快速迭代代码构建测试周期的最快方法。 The following should work on any Windows version.
以下内容适用于任何Windows版本。
First prepare - set the start program of your shell extension project to be c:\\windows\\explorer.exe and also set it to be the start-up project. 首先准备 - 将shell扩展项目的启动程序设置为c:\\ windows \\ explorer.exe,并将其设置为启动项目。
Then, whenever you want to debug your shell extension perform the following steps: 然后,每当您想要调试shell扩展时,请执行以下步骤:
Caveat on Vista and 7 - be sure to run the Visual Studio that you use for debugging in non-Administrator mode (non-elevated), so that the explorer is started in its usual non-elevated mode. Vista和7上的警告 - 确保运行用于在非管理员模式(非提升)下进行调试的Visual Studio,以便以通常的非提升模式启动资源管理器。
尝试启动资源管理器,然后将调试器附加到它。
You could try putting a DebugBreak() call in your code. 您可以尝试在代码中调用DebugBreak()。 This should launch the just-in-time debugger at the call and give you an idea of what is going on.
这应该在调用时启动即时调试器,并让您了解正在发生的事情。
You should take a look at gflags.exe, part of the standard debugging tools sdk. 你应该看看gflags.exe,它是标准调试工具sdk的一部分。 It's got all the options you need to configure (global)flags for any process startup/services/heap/pool-tagging/stacktrace's-on-allocation etc...
它具有为任何进程启动/服务/堆/池标记/堆栈跟踪分配等配置(全局)标志所需的所有选项...
Debugging Explorer.exe is usually overkill for extensions that operate in a shell view. 对于在shell视图中运行的扩展,调试Explorer.exe通常是过度的。
I personally use a little app I made that hosts an instance of IExplorerBrowser similar to this example . 我个人使用了一个我做的小应用程序来托管一个类似于这个例子的IExplorerBrowser 实例 。 If your IContextMenu item is not the default item then you can just use Notepad.exe and its open file dialog...
如果您的IContextMenu项不是默认项,那么您可以使用Notepad.exe及其打开文件对话框...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.