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

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.

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.

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.

Related

Release build fails to start due to missing ucrtbased.dll

I'm facing a weird problem.
Using cmake-3.24.2 I have built a windows application (windows 10) with c++20, in release mode. (Visual Studio 2019, x64) The application runs fine on the machine it was built.
When deploying the same application on another windows machine, it was failing to start showing an error about missing ucrtbased.dll (and subsequent vcrt debug dlls). I'm actually confused why a release build looking for a debug dll. I used dependency explorer to see if the application was linked to any debug dll and I could not find any.
Google search showed the ucrtbased.dll is part of windows sdk. The windows sdk was not installed on the target machine. Is the windows sdk needed to run the application (I thought vcruntime was sufficient).
Also the same code works fine if I used c++17 standard and deployed on the target machine. I'm wondering if there's something I'm missing with c++20.
The solution is mentioned here.
Ran dumpbin on every dll my executable is dependent on and found out the culprit

How to execute MFC application on any pcs

I'm trying to release the mfc app which can execute without installing visual studio 2015.
First, When I'm on google, this suggested that I can execute like above by installing vc++ redistributable package.
So I've installed packages but it doesn't work.
And I got the error message. The message is like - "The program cannot start because of missing mfc140ud.dll. ...."
Second, someone said that the release app instead of debug mode can be executed without visual studio.
So I compiled the app on release mode, then I didn't get the error message but it doesn't executed. What's wrong with this?
What can I do?
You distributing a DEBUG version of your application. You can tell that by the name of the DLL it says it can't find. The "d" suffix of "mfc140ud.dll" indicates it's looking for the DEBUG version of the MFC libraries. I don't think that the redistributable contains debug version. Nor should it.
Try releasing a RELEASE build to your clients.
Your application don't run on other PC because is the debug version, compiling to release and distributing on other PC having the visual studio redistributable package will do.
If you want your application to run not depending on the mfc140u.dll you can simply static link your application with MFC. This is easily accomplished going into your project properties.
Your application exe will be bigger but you won't have to bother with these kind of errors anymore. Please note that while this method works on debug too you better not distribute debug code on other machines for a number of reasons.

VS2015 : The application was unable to start correctly (0xc000007b)

I wrote a code on Visual studio 2015 for a windows 10 PC. The application is mainly focused on UDP communication and I use the boost libraries.
It works perfectly but when I move the folder of the code to Windows 7 I receive the error "The application was unable to start correctly (0xc000007b)". I tried also in Windows 8.1 and after rebuilding the libraries it works.
What I noticed is that when I receive the error it does not load the .dll that in the other versions it loads.
May it be a problem with the boost?
Have you ever experienced it?
0xc000007b is error when you try to use x64 dlls in x32 application or other way around, so you probably copied wrong dlls. Rebuild fixed this, as it prepared new dlls.
win7_64 visual studio 2015, 0xc000007b
When I was programming C++ code in the visual studio 2015, it threw the error:0x000007b, and I have tried three kinds of solutions;
1.Installing Direct X
2.Installing VC C++ 2015 libraries
3.Making sure the DLL is consistent with the OS(and I think this is relevant to my problem)
ANd my solution will show below:
enter image description here
and I changed the [[[Debug]]] into [[[X64]]], then, it works, I believe that because some dlls are not consistent with the platform, so if I changed the Debug platform, We will get the correct result.The prerequisite:must having installed all dlls under the X64 system.

Using VS2015 Express, deleted VS2013 Community, can't run "MSVCP120d.dll missing"

As per the title. I had VS2013 Community installed, I had started a project on that and then moved on the VS2015 Express and converted the project. Recently I needed extra space on my machine so I deleted 2013C using Add or Remove Programs, but now my code gives an exception immediately on running, saying "The program can't start because the MSVCP120D.dll is missing from your computer. Try reinstalling the program to fix this problem." I went and installed the VS2013 redist, and the problem still persists. Is it possible to solve this without reinstalling the entirety of VS2013?
The odd thing is, the DLL it's looking for is a debug DLL, and I'm running the .code in release mode, and I did check, the runtime library is /MT not /MTd
The .dll doesn't exist in my /Windows/System32 folder despite me having installed the redist.
Edit: I found a copy of the dll and installed it but not the code just doesn't run, it doesn't give the same exception but it just says failed to start.
The d library is not "redistributable" and only exists in the development environment.
My recommendation is to use the depends tool (drag executable into depends.exe and it shows the dll dependency), which is part of the windows kits SDK to open your executable.
That should highlight a DLL which was built with the earlier 120d configuration, and can be re-built.
I think the VS 2013 is a side-by-side assembly, and has very strange locations (windows\system32\winsxs).

Compile (?) issue. Visual studio c++ 2008

There's an app that I use on an XP netbook for tuning a car. It was working just fine. Then I needed to make a simple modification (output to STDOUT instead of to file) so I got the source from the author.
My netbook doesn't have the space for a compiler. I have Visual Studio C++ 2008 on a Windows 7 desktop. I made the adjustments, compiled and tested on the desktop and it worked perfecty. So then I copied the executable to the netbook and it won't run
"This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem"
Original (precompiled) exe works fine. To rule out my changes, I compiled the source without the mods and it still didn't work. The executable works fine on the 7 machine as well as another Win Vista machine I tried.
So its obviously something with the XP machine and the way the executable is compiled. I really have no idea how this stuff works so I don't know what to try.
Couple of ideas:
As Keith said above this is DLL/manifest issue.
Get Visual Studio 2008 redistributable (for matching application platform) and install it on the netbook.
If this does not help: Use Dependency Walker to find out what other DLLs you are missing.
Its because a dependency / DLL compiled into your application doesn't exist on the platform you are running on.
Open windows event viewer and view the application log. There will be an entry for the error and the name of the DLL which is missing. Copy / Install that DLL on your target platform.
I would guess your vc runtime has changed with visual studio 2008 and you need to copy the latest version to your target platform. If you dont know where to get the dependency DLL, post the name here and we can see what we can do about it.
You can check your project settings and make sure to use a statically linked runtime instead of a DLL.
Project Settings, C/C++ -> Code Generation. Make sure you're using a runtime library that isn't a DLL. (So Multi-threaded Debug instead of Multi-threaded Debug DLL for example).