首页 文章

无法让BHO工作在64位

提问于
浏览
20

我正在研究IE11 Browser Helper Object . 当我在x86中构建它时,我得到了它 . 问题是,我想在x64上使用该项目,当它在x64上构建时,BHO扩展无法正常工作 .

该扩展程序显示在Internet Explorer加载项屏幕上,但javascript弹出窗口未显示 .

DLL使用x64版本的regasm通过Visual Studio命令提示符作为管理员注册,有/无 /codebase/tlb 但没有结果 . 注册表项已在我的注册表中成功添加,但BHO根本无法在IE中工作 . 我也尝试将文件放在Program Files的子文件夹中,但它根本不起作用 .

当我在增强保护模式下运行我的IE时,加载项管理器显示我的BHO是 incompatible ,但是没有EPM IE显示 enabled ,即使它不起作用 .

我想让BHO在x64上工作 .

我也尝试了this 'hello world' BHO project但是当我将其更改为在x64而不是x86上构建时,会出现同样的问题 .

2 回答

  • 3

    它似乎并不适用于所有人,因此,我将描述我为使其工作所做的工作 .

    1)从这里下载示例项目:https://github.com/reinaldo13/ie-bho-extension

    2)在 BHO.cs 修改 RegisterBHO(...) 方法

    从:

    RegistryKey ourKey = registryKey.OpenSubKey(guid);
    

    至:

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

    3)为 AnyCPU 编译项目:项目属性,为平台目标选择AnyCPU .

    4)创建一个这样的.bat,适应你的路径,并将你的输出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
    

    这将注册x86和x64的dll . 这是 mandatory 以使两个版本都注册,否则IE赢得't like it (it will complain the extension is '不兼容') because it won' t能够启动它取决于您的IE设置 . 注意我想你可以为每个版本提供两个不同的文件,但.NET _3020313需要它 .

    5)运行.bat作为管理员,这是我这样做时的输出:

    "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)运行 iexplore.exe . 它可能会工作取决于您的设置(显示"HOLA!!!"消息框),但无论如何,转到菜单工具/ Internet选项/程序/管理加载项,这是我看到的:

    enter image description here

    如果禁用了扩展,您应该能够启用它(并重新启动) .

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

    enter image description here

  • 0

    Regasm.exe(程序集注册工具)HERE

    检查您的项目设置以编译为64位并检查IE版本 . 并以管理员模式运行它 .

    你的守则是完美的 . 只是系统设置和编译配置搞砸了,

    还看看这个设置https://answers.microsoft.com/en-us/ie/forum/ie11-windows_7/enable-64-bit-processes-in-ie-11/212270df-cc35-4e09-89e4-13b9da1bb6a7?auth=1

    希望这会帮助你!

相关问题