gpt4 book ai didi

windows - 在 Win 7 和 8.1 中调试 shell 扩展

转载 作者:可可西里 更新时间:2023-11-01 11:53:14 26 4
gpt4 key购买 nike

在此方面,我将真诚地感谢您的帮助。我花了几个小时试图解决它。

我用 VCPP6(是的,我知道。不用告诉我)写了一个小扩展,在 XP 下使用 IExtractImage 在资源管理器中将特定 DOS 文件的内容显示为缩略图。事实证明调试很容易——我关闭了资源管理器并按了 F5。单击所需类型的文件会生成缩略图。断点全部激活。

升级到 VS2012(同样发生在 VS2013 Express 上)并使用 IThumbnailProvider,相同的序列不起作用。

程序本身可以运行。我可以在 7 和 8.1 中显示缩略图。我不能做的是通过资源管理器调试它。我可以使用 SDK (ThumbnailProvider) 中的示例调试它,但不能使用 Explorer。

项目设置为:

Debugging->Command: C:\Windows\explorer.exe
Debugging->Command Arguments: /e,/select,F:\NewWork\NSD-24kW\pcb\15300003.pcb
Debugging->Working Directory: $(ProjectDir) (I've tried $(OutDir) too)
Debugging->Attach: No (I've tried 'yes' too)
Debugging->Debugger Type: Native Only
Debugging->Environment: (not set)
Debugging->Merge Environment: Yes

搜索我能想到的每个变体来调试 shell 扩展并尝试我能找到的指导中的每个可能的变体,但它仍然没有看到断点。

最佳答案

该扩展现在可能不托管在 explorer.exe 中,而是托管在 dllhost.exe(一种 Windows 功能,可将可能存在错误的扩展与关键的 Windows 进程隔离开来)。

您可以将其配置为使用 explorer.exe 在进程内托管以简化调试,如此处所述:C++ Windows Shell thumbnail handler (CppShellExtThumbnailHandler)

Debugging thumbnail handlers is difficult for several reasons.

1) The Windows Explorer hosts thumbnail providers in an isolated process to get robustness and improve security. Because of this it is difficult to debug your handler as you cannot set breakpoints on your code in the explorer.exe process as it is not loaded there. The isolated process is DllHost.exe and this is used for other purposes so finding the right instance of this process is difficult.

2) Once a thumbnail is computed for a particular file it is cached and your handler won't be called again for that item unless you invalidate the cache by updating the modification date of the file. Note that this cache works even if the files are renamed or moved.

Given all of these issues the easiest way to debug your code in a test application then once you have proven it works there test it in the context of the explorer.

Another thing to do is to disable the process isolation feature of explorer. You can do this by putting the following named value on the CLSID of your handler

HKCR\CLSID{CLSID of Your Handler}

   DisableProcessIsolation=REG_DWORD:1

Be sure to not ship your handler with this on as customers require the security and robustness benefits of the isolated process feature.

关于windows - 在 Win 7 和 8.1 中调试 shell 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24232451/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com