How to fix DLL dependency problem?

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
akopalsky
Junior Member
Junior Member
Posts: 48
Joined: 2012-10-10, 15:25 UTC

How to fix DLL dependency problem?

Post by *akopalsky »

I am trying to fix DLLs problem in Google Drive plugin, which was reported by several users.

The problem is with SFTP plugin which uses older version of Open SSL libraries (ssleay32.dll and libeay32.dll). Because those DLLs are not dynamically loaded, they should appear in Windows search path.

Windows search path usually includes application folder, this is why I instructed Google Drive plugin users to copy those files to TC root directory.

But this caused crashes in SFTP plugin, because now SFTP loads my version of DLLs (residing in TC folder) instead.

I cannot find a proper way to put those DLLs inside plugin directory, instead of TC root. SFTP developer solved this problem somehow, because he does not require copying those DLLs to TC root.

I tried preloading DLLs with LoadLibraryEx and LOAD_WITH_ALTERED_SEARCH_PATH flag, but it didn't helped......

THis is real DLL hell here.....
Please help!

Thanks
Paul
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

When using LoadLibraryEx did you set the full file path of libeay32.dll and ssleay32.dll?

You could alternatively use static libraries (libeay32.lib, ssleay32.lib) and avoid the external DLL dependencies.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
akopalsky
Junior Member
Junior Member
Posts: 48
Joined: 2012-10-10, 15:25 UTC

Post by *akopalsky »

Using is static linking is not that easy in my case (tried it)

Yes I am providing full path and I verified using Process Explorer that those DLLs are loaded.
There is something I am missing - I read somewhere that it is suggested NOT to call LoadLibraryEx with this flag inside DllMain and it is exactly what I am doing.....

Suggestions?
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

Did you try to call LoadLibraryEx in FSInit instead?
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
akopalsky
Junior Member
Junior Member
Posts: 48
Joined: 2012-10-10, 15:25 UTC

Post by *akopalsky »

No,

I'll try.... good idea..
akopalsky
Junior Member
Junior Member
Posts: 48
Joined: 2012-10-10, 15:25 UTC

Post by *akopalsky »

I tried loading libs in FsInit. I also looked on SFTP sources (they used regular LoadLibrary instead of LoadLibraryEx with LOAD_WITH_ALTERED_SEARCH_PATH)....

Nothing is working....

The only thing works for me is putting those files inside TC root folder....

Ideas?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

A Windows program cannot load two versions of the same DLL at the same time, so if you use the SFTP plugin and then Google Drive, the SFTP dlls loaded by the SFTP plugin will be used.

The only way would be to rename the DLLs (but will this rename the module names too?).
Author of Total Commander
https://www.ghisler.com
akopalsky
Junior Member
Junior Member
Posts: 48
Joined: 2012-10-10, 15:25 UTC

Post by *akopalsky »

2ghisler

I realize that it is problematic to load two files at the same time. What I am trying to do is to eliminate the need to copy different file version to TC root each time the user wants to switch between SFTP or GD...

If I'll find a way to keep SSL dlls inside plugin directory - it will be enough, even though the user would not be able to use these modules at the same time.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Have you tried my suggestion to rename your dlls?
Author of Total Commander
https://www.ghisler.com
akopalsky
Junior Member
Junior Member
Posts: 48
Joined: 2012-10-10, 15:25 UTC

Post by *akopalsky »

These are not DLLs I can rename - we are talking about SSL libraries used by QT....
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Could you try the very latest SSL+SSH libraries from the curl library? They seem to work again with the SFTP plugin, no more crashes.
Author of Total Commander
https://www.ghisler.com
akopalsky
Junior Member
Junior Member
Posts: 48
Joined: 2012-10-10, 15:25 UTC

Post by *akopalsky »

I tried DLLs from curl-7.28.1 (http://curl.haxx.se/gknw.net/7.28.1/dist-w32/curl-7.28.1-devel-mingw32.zip)

They work for Google Drive plugin (when put inside TC dir), but SFTP displays a message "Please put libssh2.dll and libeay32.dll...".
(Both of those files are available in TC dir)

Strange....
akopalsky
Junior Member
Junior Member
Posts: 48
Joined: 2012-10-10, 15:25 UTC

Post by *akopalsky »

Version 0.9 is out.....

What's new
  • Better handling of existing files overwrite
    Trashed files are not shown anymore (will consider implementing custom columns to show them again in future)
    File attributes are displayed correctly
    Logout confirmation message shows account name
    File copy support
    Fixed: "Token empty" message bug
    NOT YET FIXED: compatibility bug with sftp plugin
This version might be considered as Beta (I think that the next one will be 1.0)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2akopalsky
I'm using this version with SFTP here, no problem. Make sure to put all of the following dlls in the TC directory:
libssh2.dll
ssleay32.dll
libeay32.dll
zlib1.dll
Author of Total Commander
https://www.ghisler.com
Post Reply