My plugin does not load in the newest versions



  • My plugin (AJC Active Backup) loads on v5.9 and works fine. On the newer versions it just does not load. I’ve tried moving it to different locations like app data etc but it never loads. Is this likely to be a location problem or has some other thing with compatibility of the dll changed in the newer versions?



  • @Andrew-Cutforth

    Plugins that used to be directly in the plugins folder now have to be one level down, e.g.:

    ...\plugins\XXX.dll

    needs to go in:

    ...\plugins\XXX\XXX.dll



  • I tried that. So it is normally:
    C:\Program Files (x86)\Notepad++\plugins\AJCActiveBackupNppPlugin.dll

    So I tried it in:
    C:\Program Files (x86)\Notepad++\plugins\AJCActiveBackupNppPlugin\AJCActiveBackupNppPlugin.dll

    It still does not find it. If I reinstall Notepad++ v7.5.9 it works again.



  • @Andrew-Cutforth said:

    It still does not find it.

    Does it give an error message (often through a dialog box), or does it just silently ignore it? There are some plugins that worked with old versions of Notepad++ that don’t work under the new, due to changes in the Notepad++ codebase… but those would generally either load fine but give errors when you try to run one of their actions, or would give an error during the loading of the plugin.

    Are you sure there aren’t any spaces in the DLL name? If there are, there need to be spaces in the path name as well.

    Please supply the Debug Info (? Menu, Debug Info, Copy Debug info into clipboard) on the version that isn’t working. And, if possible, drop to a command prompt in your plugins directory, and give us a directory listing of the plugins directory and the subdirectory. paste into notation like

    ~~~
    dir C:\Program Files (x86)\Notepad++\plugins
    dir C:\Program Files (x86)\Notepad++\plugins\AJCActiveBackupNppPlugin
    ~~~
    

    to wrap your output, so it renders like:

    dir C:\Program Files (x86)\Notepad++\plugins
    dir C:\Program Files (x86)\Notepad++\plugins\AJCActiveBackupNppPlugin
    

    This will then make sure that the forum doesn’t mangle what you’re trying to show us.



  • It does not give any error message, just starts up and my plugin is not loaded.

    Debug info:
    Notepad++ v7.6 (32-bit)
    Build time : Nov 12 2018 - 23:51:42
    Path : C:\Program Files (x86)\Notepad++\notepad++.exe
    Admin mode : OFF
    Local Conf mode : OFF
    OS : Windows 10 (64-bit)
    Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll

    Folder listings with my plugin in two places

    Directory: C:\Program Files (x86)\Notepad++\plugins
    

    Mode LastWriteTime Length Name


    d----- 25/07/2019 15:47 AJCActiveBackupNppPlugin
    d----- 25/07/2019 12:36 APIs
    d----- 25/07/2019 12:42 Config
    d----- 25/07/2019 12:36 disabled
    d----- 26/07/2019 10:27 DSpellCheck
    d----- 26/07/2019 10:27 mimeTools
    d----- 26/07/2019 10:27 NppConverter
    d----- 26/07/2019 10:27 NppExport
    -a---- 02/05/2019 10:12 73728 AJCActiveBackupNppPlugin.dll

    Directory: C:\Program Files (x86)\Notepad++\plugins\AJCActiveBackupNppPlugin
    

    Mode LastWriteTime Length Name


    -a---- 02/05/2019 10:12 73728 AJCActiveBackupNppPlugin.dll



  • @Andrew-Cutforth

    do you know ProcMon?
    Set a filter to something like path contains AJCActiveBackupNppPlugin and see what is going on.



  • @Andrew-Cutforth said:

    Notepad++ v7.6 (32-bit)

    I do not recommend using that version. Versions 7.6 thru 7.6.2 were in a state of flux in regard to the plugin hierarchy, where they matched neither the old v7.5.9-and-earlier hiearchy or the v7.6.3-and-newer hierarchy. The plugin hierarchy stabilized in v7.6.3, and has stayed the same from then thru the current v7.7.1.



  • Thanks I thought I was on the latest version. Anyway using ProcMon, Notepad++ v7.6 was finding my plugin here:
    C:\Users\myname\AppData\Local\Notepad++\plugins\AJCActiveBackupNppPlugin\AJCActiveBackupNppPlugin.dll

    Now using v7.5.1 it is finding my plugin here:
    C:\Program Files (x86)\Notepad++\plugins\AJCActiveBackupNppPlugin\AJCActiveBackupNppPlugin.dll

    My product AJC Active Backup has the option to install the plugin and copies it to the the plugins folder. So for compatibility for different versions of Notepad++ I suppose I will have to now copy the plugin to both locations:
    C:\Program Files (x86)\Notepad++\plugins\AJCActiveBackupNppPlugin.dll
    C:\Program Files (x86)\Notepad++\plugins\AJCActiveBackupNppPlugin\AJCActiveBackupNppPlugin.dll



  • @Andrew-Cutforth said:

    So for compatibility for different versions of Notepad++ I suppose I will have to now copy the plugin to both locations:

    You could also use the Win32 APIs GetFileVersionInfoSize, GetFileVersionInfo and VerQueryValue to query the version number from the file notepad++.exe in order to decide which target directory to choose.

    I provide you some Delphi code that does the job. You should be able to port that to your preferred programming language.

    Documentation of the VS_FIXEDFILEINFO struct : https://docs.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-tagvs_fixedfileinfo

    // Enum to specify the type of numeric version info to query
    TNumericFileVersionInfoTag = (
      nfvitFileVersion,
      nfvitProductVersion
    );
    
    
    class function TFileVersionInfo.GetNumericVersionInfo(const FileName: string; const InfoTag: TNumericFileVersionInfoTag; out VersionMajor, VersionMinor, Release, Build: integer): boolean;
    var
      dwLen:    DWORD;
      dwHandle: DWORD;
      lpData:   pointer;
      dwBytes:  UINT;
      FileInfo: PVSFixedFileInfo;
    
    begin
      Result       := false;
    
      VersionMajor := 0;
      VersionMinor := 0;
      Release      := 0;
      Build        := 0;
    
      dwLen := GetFileVersionInfoSize(PChar(FileName), dwHandle);
      if dwLen = 0 then exit;
    
      GetMem(lpData, dwLen);
    
      try
        if not GetFileVersionInfo(PChar(FileName), dwHandle, dwLen, lpData) then
          exit;
    
        if not VerQueryValue(lpData, '\', pointer(FileInfo), dwBytes) then
          exit;
    
        case InfoTag of
          nfvitProductVersion:
          begin
            VersionMajor := (FileInfo.dwProductVersionMS) shr 16;
            VersionMinor := (FileInfo.dwProductVersionMS) and $FFFF;
            Release      := (FileInfo.dwProductVersionLS) shr 16;
            Build        := (FileInfo.dwProductVersionLS) and $FFFF;
          end;
    
          nfvitFileVersion:
          begin
            VersionMajor := (FileInfo.dwFileVersionMS) shr 16;
            VersionMinor := (FileInfo.dwFileVersionMS) and $FFFF;
            Release      := (FileInfo.dwFileVersionLS) shr 16;
            Build        := (FileInfo.dwFileVersionLS) and $FFFF;
          end;
        end;
    
        Result := true;
    
      finally
        FreeMem(lpData);
      end;
    end;
    


  • Thanks for your help



  • @Andrew-Cutforth See https://github.com/notepad-plus-plus/nppPluginList. You may want to provide a zip package which could be installed via PluginAdmin for N++ versions newer than 7.6.3.


Log in to reply