windowsplugins64-bitnpapifirebreath

64 bit Firebreath NPAPI Plugin not registering in Windows


I have generated a test Plugin using prep2015x64.cmd.

prep2015x64.cmd contents are given below

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"

The Plugin is completely generated, and to ensure it is 64 bit, I cross checked it with dumpbin /Headers and it gives that DLL is 64 bit

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

Then, I try to register it, using an elevated Command Prompt in C:\Windows\SysWOW64. I use the following command for registration

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

It gives me an error:

   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

I am using Windows 7, 64 Bit Operating System, so I am really confused as to what is going wrong here. Is it the plugin generation or something else. Is there any alternate way to get the Plugin registered.

Thanks in advance.


Solution

  • Here's what I did to get it working. I used Visual Studio 2008.

    1. Generated the plugin using fbgen.py
    2. Run the prep2008x64.cmd. Build files and vcproj gets generated in this step.
    3. Open Plugin.vcproj file in any editor and replace /machine:X86 with /machine:X64
    4. Open vcproj and then add "Additional Library Dependencies" with "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\lib\amd64". This is required for ATL Libraries.
    5. I was not sure of whether it gets linked with 32 bit libraries or 64 bit libraries. So, I explicitly added "Additional Dependencies" in Linker Input with the following below list

      "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"

    6. Changed the "Target Machine" in Linker Advanced from "Not Set" to "MachineX64(/MACHINE:X64)"

    7. Built the Plugin
    8. Registered the plugin using normal cmd prompt (NOT elevated cmd prompt) and normal regsvr32.exe (NOT specific like C:\Windows\SysWOW64) C:\Users\Username>regsvr32.exe npPlugin.dll
    9. Tried with Firefox 64 bit version 44.0.2, but it did not work. I thought it was problem with plugin. But no, I later downloaded ChromiumPortable_43.0.2357.18.paf.exe (64 Bit) from https://sourceforge.net/projects/crportable/files/ . Chromium version below 44 only support npapi plugins.
    10. Install the Chromium Portable and enabled npapi plugins in chrome://flags and later launched FBControl.htm. Finally it worked.....!!!