1

I am using Synapse in a small software (created with Delphi 7) for HTTPS requests. SSL libraries (libeay32.dll/ssleay32.dll) are saved in software resources, so when it opens the dll files are copied to the Windows temp folder. I also use SetDllDirectory pointing to temp folder, so application can "see" the libraries.

For long time, few users were complaining about error 500, so I decided do dig the issue. Discovered that there is another software that record old version of SSL libraries in the Windows system folder, and my software are trying to use them.

Looking in Synapse source I see it calls LoadLibrary without specifying the library path, so I tried to add temp folder to Windows environment path (SetEnvironmentVariable) as suggested in this post Delphi LoadLibrary Failing to find DLL other directory - any good options?, but no success :(

I also tried to load the libraries myself using LoadLibraryEx, with the LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR flag, but again the issue persists...

Please, someone have an idea what is going on and how to solve?

PS. Sorry, english is not my native language

Thom A
  • 88,727
  • 11
  • 45
  • 75
Guybrush
  • 1,575
  • 2
  • 27
  • 51
  • See [Dynamic-Link Library Search Order](https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order). Best if you deploy the DLLs in your EXE folder, not via resources extracted at runtime. If that is not an option, then load the DLLs yourself using absolute paths, then subsequent loads using only filenames with use what you have already loaded. The EXE folder is searched first, and the PATH is searched last after system folders and alternate folders from `SetDllDirectory()` – Remy Lebeau May 24 '20 at 20:33
  • Or rename both filenames to more distinctive ones and edit the Synapse source. You'll need to edit it anyway once you discover SSL1.0 is horribly outdated and you have to adapt to the new naming scheme - see https://sourceforge.net/p/synalist/feature-requests/19/#51f0 – AmigoJack May 25 '20 at 02:04
  • Thank you @RemyLebeau and @AmigoJack for the tips. After almost 8 hours working in this issue and MANY tests I end up creating a copy of the Synapse units `ssl_openssl.pas` and `ssl_openssl_lib.pas` to my software folder and changing them to use the Windows temporary folder. – Guybrush May 25 '20 at 14:26

0 Answers0