Search code examples
delphisslexceptionmsvcr120.dll

Catch MSVCR120 missing error message in Delphi


I wrote an unattended HTTPS upload client which shouldn't require user interaction.

Everything was flawless until I deployed it blindly to a remote system that I do not have a remote desktop access to. The tool reported in logs that SSL libraries are missing.

Ok, I deployed LIBEAY32.dll and SSLEAY32.dll to the application folder on the remote system, but then the tool hung and I couldn't figure out what was going on until I wrote a tool which makes a remote screenshot.

On the screenshot I see a modal window from csrss.exe process with a message:

The program can't start because MSVCR120.dll is missing from your computer.

The window appeared despite of having a lot of try except blocks and Application.OnException handler.

I would like that in such cases application would not be hold up so it can report failure to it's log.

How to achieve this?

In a current implementation TIdHttp.Post call just hangs.

P.S. I solved the absence of DLL by copying it to app folder, but my question is about catching such errors.


Solution

  • To avoid this error, you can use the OpenSSL DLLs available on https://indy.fulgan.com/SSL/

    They do not have this dependency on MSVCRT.

    Or, use TNetHTTPClient.

    From this answer:

    TNetHTTPClient was introduced in Delphi XE8.

    The most important benefit of TNetHTTPClient is that it allows your application to support HTTPS without having to provide your own support for SSL/TLS. TNetHTTPClient relies on the SSL/TLS support provided by the operating system.