Gerald Davis
Gerald Davis

Reputation: 4549

Error "msvcr100.dll" (only on Windows 7 & Vista) even AFTER statically linking (/MT)

I have a simple dll that is being injected into a target process using MS detours. The process doing the injecting is C# .net application.

Both the DLL and the detours library have been statically linked (/MT option).

However when I try to inject the dll into a target program on a client's machine I get error "msvcr100.dll" is missing" error. Now I open the dll w/ depends and there is no dependency on "msvcr100.dll".

Even weirder this issue only happens when the client is vista x64 or windows 7 x64. The dll is successfully injected on windows xp x32 and windows 7 x32 systems.

Any ideas on what bug in visual studio is indicating a dependency on a library not being used?

On edit: Looks like someone else had the same issue ... never resolved. Compiled .dll files requiring msvcr100.dll to load

For the record installing Visual studio 2010 C++ redistributable on client machine "solves" the issue however I hoped to avoid that dependency by statically linking.

Upvotes: 0

Views: 2428

Answers (2)

Gerald Davis
Gerald Davis

Reputation: 4549

So I never did discover exactly what the issue is but on a hunch I tried running the application (exact same build w/ mscvr100.dll error) on another Windows 7 machine and it worked fine.

I reinstalled Windows 7 on the "problem" machine and the same build works fine without error. In my google searching I came across a report of another person having this issue after uninstalling Visual Studio. I know for a fact that Visual Studio was installed on the "problem" Windows 7 machine at one time and was currently uninstalled.

If this happens to someone else I would recommend try running the binary on a machine that has never had visual studio installed. If it works without issue then likely there is some issue related to VS uninstall.

Upvotes: 1

Michael Burr
Michael Burr

Reputation: 340228

You might be able to figure out what's going on my attaching (pre-injection) the cdb debugger to the process on a machine where msvcr100.dll is loaded (with the DLL installed). Use the

sxe ld:msvcr100

command to break when that DLL is loaded (I'm not 100% sure if that's the exactly correct syntax). Once it's loaded, you might be able to figure out why by looking at the call stack. If not, try setting a breakpoint on everything in that module:

bm msvcr100!*

and see who's calling it. That should give you a really good idea why it's being loaded.

Upvotes: 1

Related Questions