Search code examples
nsis

NSIS loading an NPAPI plugin


i have a NPAPI plugin !

How do i register the dll with an NSIS installer ? I tried this and it the compiler gives errors:

 # define the name of the installer
 outfile "simple installer.exe"

 RegDLL plugin.dll

 sectionEnd

The error is :

Error: command RegDLL not valid outside Section or Function Error in script "C:\Program Files\NSIS\test01.nsi" on line 4 -- aborting creation process


Solution

  • RegDLL is for DLL's that export the DllRegisterServer function. It is usually used by COM DLL's.

    You can register a plugin with firefox by using the NSIS registry functions:

    !define pluginid "@example.com/myplugin"
    Outfile "setup.exe"
    InstallDir "$programfiles\myplugin"
    
    Page Instfiles
    
    Section
    SetOutPath $InstDir
    File "myplugin.dll"
    
    WriteRegStr HKLM "SOFTWARE\MozillaPlugins\${pluginid}" "Path" "$InstDir\myplugin.dll"
    WriteRegStr HKLM "SOFTWARE\MozillaPlugins\${pluginid}" "ProductName" "my plugin"
    WriteRegStr HKLM "SOFTWARE\MozillaPlugins\${pluginid}" "Description" "my useless plugin"
    ;Add Vendor,Version etc...
    SectionEnd
    

    ..but if your NPAPI plugin actually has a DllRegisterServer export, you could use RegDLL...