无法使BHO在64位中工作 [英] Cannot get BHO working in 64 bit

查看:174
本文介绍了无法使BHO在64位中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理IE11浏览器帮助器对象。当我在x86中构建它时,它可以工作。问题是,我想在x64上使用该项目,但BHO扩展程序在x64上构建时无法正常工作。



该扩展名显示在Internet Explorer add-屏幕上,但未显示javascript弹出窗口。



使用x64版本的regasm通过DLL以管理员身份通过Visual Studio命令提示符注册DLL,无论是否使用 / codebase / tlb ,但没有结果。注册表项已成功添加到我的注册表中,但BHO无法在IE中正常工作。我也尝试过将文件放在程序文件的子文件夹中,但是根本不起作用。



当我在增强保护模式下运行IE时,加载项管理器显示我的BHO与不兼容,但是如果没有EPM,则IE会显示已启用,即使它无法正常工作。



我想让BHO在x64上工作。



我还尝试了



如果扩展名被禁用,您应该能够启用它(并且重新启动)。



如果它不起作用(默认情况下不应该),请确保已选中为增强保护模式启用64位进程* (需要重新启动)。对我来说,该消息是错误的,它应该只说启用64位进程 ...




I'm working on IE11 Browser Helper Object. I got it working when I build it in x86. The problem is, I want to use the project on x64 the BHO extension isn't working when it's built on x64.

The extension shows up in the Internet Explorer add-ons screen, but the javascript popup is not showing up.

The DLL is registered using the x64 version of regasm via the Visual Studio command prompt as administrator, with/without the /codebase and /tlb but without result. The registry key is added successfully in my registry but the BHO is simply not working in IE. I've also tried placing the files in a subfolder of Program Files, but it simply is not working.

When I run my IE in Enhanced Protected Mode the add-on manager shows that my BHO is incompatible, but without EPM the IE shows enabled even though it's not working.

I'd like to get the BHO working on x64.

I also tried this 'hello world' BHO project but when I change it to build on x64 in stead of x86 the same problem occurs.

解决方案

It seems it doesn't work for everyone, so, I'll describe what I did to make it work.

1) download the sample project from here: https://github.com/reinaldo13/ie-bho-extension

2) modify RegisterBHO(...) method in BHO.cs

from:

RegistryKey ourKey = registryKey.OpenSubKey(guid);

to:

  RegistryKey ourKey = registryKey.OpenSubKey(guid, true); //we want to write the registry

3) compile the project for AnyCPU: Project properties, select AnyCPU for the platform target.

4) create a .bat like this, adapt yo your path, and copy that aside your outputs dll:

 "c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
 "c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" ieextension.dll /codebase   

This will register the dll for x86 and x64. This is mandatory to have both version registered otherwise IE won't like it (it will complain the extension is 'incompatible') because it won't be able to start it depending on your IE settings. Note I suppose you can have two different files for each version but .NET's AnyCPU doesn't need that.

5) run that .bat as admin, here is the output when I do this:

"c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
Microsoft .NET Framework Assembly Registration Utility version 4.7.2046.0
for Microsoft .NET Framework version 4.7.2046.0
Copyright (C) Microsoft Corporation.  All rights reserved.

RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
Types registered successfully
"c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
Microsoft .NET Framework Assembly Registration Utility version 4.7.2046.0
for Microsoft .NET Framework version 4.7.2046.0
Copyright (C) Microsoft Corporation.  All rights reserved.

RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
Types registered successfully

6) run iexplore.exe. It may work depending on your settings (displays a "HOLA!!!" messagebox), but anyway, go to menu Tools / Internet Options / Programs / Manage add-ons, this is what I see:

If the extension is disabled, you should be able to enable it (and restart).

If it doesn't work (by default it shouldn't), make sure you've checked "Enable 64-bit processes for Enhanced Protected Mode*" (needs restart). To me the message is wrong, it should just say "Enable 64-bit processes"...

这篇关于无法使BHO在64位中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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