64 位 Firebreath NPAPI 插件未在 Windows 中注册

64 bit Firebreath NPAPI Plugin not registering in Windows

我已经使用 prep2015x64.cmd 生成了一个测试插件。

prep2015x64.cmd内容如下

echo off & setlocal enableextensions enabledelayedexpansion
set _FB_GEN="Visual Studio 14 Win64"
call "%~d0%~p0\common.cmd" %*
if %errorlevel% == 2 exit /b 1
call "%~d0%~p0\winprep.cmd"

插件完全生成,为了确保它是 64 位的,我用 dumpbin /Headers 交叉检查它,它给出 DLL 是 64 位的

FILE HEADER VALUES
            8664 machine (x64)
               9 number of sections
        56DFCDF9 time date stamp Wed Mar  9 12:47:13 2016
               0 file pointer to symbol table
               0 number of symbols
              F0 size of optional header
            2022 characteristics
                   Executable
                   Application can handle large (>2GB) addresses
                   DLL

然后,我尝试在 C:\Windows\SysWOW64 中使用提升的命令提示符来注册它。 我使用以下命令进行注册

C:\Windows\SysWOW64> C:\Windows\SysWOW64\regsvr32.exe C:\workspace\firebreath\build\bin\TestPlugin\Release\TestPlugin.dll 

它给我一个错误:

   The Module "C:\workspace\firebreath\build\bin\TestPlugin\Release\TestPlugin.dll"
 may not be compatible with version of Windows that you are running. 
Check if the module is compatible with an X86(32-bit) or X64(64-bit) version of regsvr32.exe

我正在使用 Windows 7、64 位操作系统,所以我真的很困惑这里出了什么问题。是插件生成还是其他什么。 是否有任何替代方法来注册插件。

提前致谢。

问题很可能是您使用的是 32 位版本的 regsvr32; syswow64 代表 "system Windows on Windows 64",换句话说,它是 windows 64 位上的 32 位 windows。您实际上(具有讽刺意味的是)想要使用 c:\windows\system32\regsvr32.exe 文件。

为了安全起见,只需使用路径中的那个,而不是指定一个特定的,您将始终获得正确的那个(除非计算机的配置搞砸了)。如果是 32 位 DLL,64 位版本将自动链接到 32 位版本,但如果是 64 位 DLL,32 位版本将无法正常工作。

以下是我为使其正常工作所做的工作。我用的是 Visual Studio 2008。

  1. 使用 fbgen.py
  2. 生成插件
  3. 运行 prep2008x64.cmd。在此步骤中生成文件和 vcproj。
  4. 在任何编辑器中打开 Plugin.vcproj 文件并将 /machine:X86 替换为 /machine:X64
  5. 打开vcproj然后添加"Additional Library Dependencies"和"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\lib\amd64"。这是 ATL 库所必需的。
  6. 我不确定它是与 32 位库还是 64 位库链接。因此,我在链接器输入中明确添加了 "Additional Dependencies",下面列出了

    "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\Kernel32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\User32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\Gdi32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\WinSpool.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\Shell32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\Ole32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\OleAut32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\Uuid.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\ComDlg32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\AdvAPI32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\Psapi.lib" “....\ActiveXCore\Debug\ActiveXCore.lib” “....\PluginCore\Debug\PluginCore.lib” "PluginAuto\Debug\PPL_PluginAuto.lib" “....\NpapiCore\Debug\NpapiCore.lib” “....\ScriptingCore\Debug\ScriptingCore.lib” “....\boost\libs\thread\Debug\boost_thread.lib” “....\boost\libs\system\Debug\boost_system.lib” "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\WinInet.lib"

  7. 将高级链接器中的 "Target Machine" 从 "Not Set" 更改为 "MachineX64(/MACHINE:X64)"

  8. 构建插件
  9. 使用正常的 cmd 提示符(不是提升的 cmd 提示符)和正常的 regsvr32.exe(不像 C:\Windows\SysWOW64 那样具体)注册了插件 C:\Users\Username>regsvr32.exe npPlugin.dll
  10. 尝试使用 Firefox 64 位版本 44.0.2,但没有成功。我还以为是插件的问题。但是没有,我后来从 https://sourceforge.net/projects/crportable/files/ 下载了 ChromiumPortable_43.0.2357.18.paf.exe (64 位)。 44 以下的 Chromium 版本仅支持 npapi 插件。
  11. 在 chrome://flags 中安装 Chromium Portable 和启用的 npapi 插件,稍后启动 FBControl.htm。终于成功了......!!!