2

I have a program which depends on MSVCR90.dll, library which I'm shipping with it alongside the main executable among other things:

ProgramFolder\Main.exe
ProgramFolder\MSVCR90.dll

I wanted to know if when a new update to it is available (fixing a security issue for example) the one I supply would take precedence over the updated file in System32 or SxS.

Is there a way to programatically know which version of the C runtime is being used?

James Russell
  • 339
  • 1
  • 3
  • 12
  • According to [this blog post](http://blogs.msdn.com/b/astebner/archive/2010/05/05/10008146.aspx), you can check for product codes in the registry. – Moshe Aug 20 '12 at 23:37
  • `VerQueryValue`, searching for `FileVersion` seems like a reasonable possibility. As to what will take precedence: I'm pretty sure that'll depend on where/how you install yours, and probably on your manifest as well. – Jerry Coffin Aug 20 '12 at 23:40
  • You can't deploy msvcr90.dll in the same directory as the exe, you'll get a runtime error at startup. It must be deployed in the side-by-side cache. The security updates are thus ensured. – Hans Passant Aug 21 '12 at 00:29
  • 1
    Don't ship the DLL, ship the installer for the MSVC redistributable and either run it as part of your install process or ask users to run it manually if you don't have an installer. – Adam Rosenfield Aug 21 '12 at 00:45

1 Answers1

1

You can check the executables import header to find which version of C runtime it has got references to. Removing it from system32 directory wont help, instead it will create a crash.

perilbrain
  • 7,961
  • 2
  • 27
  • 35