Nigel Thomas 36 Posted September 14, 2023 Hi, Is it possible to specify the directory in which to search for the OpenSSL Dlls, rather than having them in the same directory as the executable? Forgive me if this should have been easy to find out for myself; I'm an ICS virgin and it's taking me a while to find my way around the source. Nigel Share this post Link to post
FaFaFooey 6 Posted September 15, 2023 Unless ICS hard codes the path, I believe it's Windows that has a search order for the DLLs that are loaded by your application. Read this https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order Share this post Link to post
Angus Robertson 577 Posted September 15, 2023 There are several global variables used to determine how OpenSSL is loaded, this chunk of code is from the OverbyteIcsHttpRestTst1 unit, but most ICS samples have something similar. // Avoid dynamical loading and unloading the SSL DLLs plenty of times // GSSLEAY_DLL_IgnoreNew := True; { ignore OpenSSL 3.0 and later } // GSSLEAY_DLL_IgnoreOld := True; { ignore OpenSSL 1.1 } // note both not allowed true GSSL_DLL_DIR := FProgDir; { only from our directory } GSSL_SignTest_Check := True; { check digitally signed } GSSL_SignTest_Certificate := True; { check digital certificate } OverbyteIcsWSocket.LoadSsl; if NOT GSSLStaticLinked then begin if NOT FileExists (GLIBEAY_DLL_FileName) then LogWin.Lines.Add('SSL/TLS DLL not found: ' + GLIBEAY_DLL_FileName) else LogWin.Lines.Add('SSL/TLS DLL: ' + GLIBEAY_DLL_FileName + ', Version: ' + OpenSslVersion); end else LogWin.Lines.Add('SSL/TLS Static Linked, Version: ' + OpenSslVersion); This version ensures the DLLs are only loaded from our own directory using GSSL_DLL_DIR, since Windows may have dozens of different versions of the DLLs scattered around the drive from different applications. The code loads OpenSSL once and tells you what version it found and where, and whether YuOpenmSSL is being used which avoids all DLL problems. Might have to revisit the IgnoreNew/Old stuff since 1.1 is now out of support. Angus 1 Share this post Link to post