Improving the dll missing error message - c++

I have a program written in QT that works just fine. However it has an indirect dependency on dnssd.dll since a dll loaded by the program uses bonjour. If bonjour is not installed on the machine running the program it will say
The program can't start because dnssd.dll is missing from your
computer. Try reinstalling the program to fix the problem.
I'm not loading this dll via LoadLibrary or otherwise. I linked the binary against the stub so it's loaded automatically before int main.
Obviously reinstalling the program does not fix the problem. For me it clearly says I need to install bonjour, but for most users this is extremly cryptic.
I would rather have this error message be something more informative such as "Bonjour needs to be installed for this application to work properly, go to [insert-url-here] to download it."
Is there a way to detect when a dll fails to load loke this and give a better error message?

Set it to delay load, then as early as possible (before you cause loading to happen), try to load it yourself (with LoadLibrary) and report the problem.
http://msdn.microsoft.com/en-us/library/151kt790.aspx

Related

Excel VBA does not find a DLL-file programmed by myself

in Excel-VBA I programmed a small production planning front-end which calls a wrapper (dll programmed in C++, Visual Studio 2022), which in turn calles Autonester-x64.dll (a commercial solver to optimaly nest shapes). On two Windows 10 machines this works fine. On the third computer, which is used in production, it does not work:
(1) The excel VBA-program raises the error "File not found"
(2) If I try to register the wrapper.dll, it raises the following error:
error message from regsvr32
Of course, regarding (1) I carefully checked the file locations about 10 times, so this can not be the cause. I then thought, lets get rid of the problem by registering the dll -- but without success. Its so stupid, but I have no more ideas what I could try to solve it... Any help is most welcome!
This message from the Windows DLL loader is useless junk. I would first check the Office version (x32 or x64).
Take a look at the DllManager VBA class. Maybe it will help. I use it to load DLLs on Windows 10 from a user folder without any registration. It also runs a few basic checks, and it might provide a more useful error message.

Unique scientific software getting 0xc00007b error after update on Windows 10

The program is a custom developed user interface and calculation tool built-in c++ and QT, it uses unfortunately a lot of different components, And I can't tell what's failing because of the nondescriptness of the error code.
Program compiles just fine and was working perfectly well before the update, unfortunately, this is a project I've been working on for quite a while and is quite large.
Thank you
Sorry for such an inane question
EDIT:
as for running it with a debugger, it does not get to that point, the program starts to launch, then dies with that error message, thank you
Edit:
code was 100% fine before the update, so was looking for advice, sorry
Looks like STATUS_INVALID_IMAGE_FORMAT to me. So it failed trying to load the *.exe file or some *.dll dependency.
To figure out which binary it had trouble loading you can use Gflags to enable loader snaps for your *.exe file.
Then when you start your exe file from within a debugger like WinDbg it should output the loader debugging info.

Why I get a "Application failed to initialize properly (0xc0000018)" when I build program in vs2015 sometimes

I write a c++ program using visual studio 2015 community in windows 7(64bit).
When I begin to run the program, sometimes the program will terminate, and a dialog box shows up, saying
"Application failed to initialize properly 0xc0000018".
Why do I get this error sometimes rather than always?
Thanks a lot.
Besides a bad application itself (that should be possible to track in the debugger):
This might be a corrupted Windows installation or Windows registry as well. Do you see it only for your application or also for some other applications?
It might be caused e.g. by some DLL that is built to be installed at fixed address, it might be a virus, malware, or even antivirus getting into the way.
Some of the reasons/solutions are mentioned e.g. here: https://superuser.com/questions/610495/the-application-was-unable-to-start-correctly-0xc0000018-windows-8-x64
The first thing to try is to remove the contents of APPINIT_DLLS in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\­Microsoft\WindowsNT\CurrentVersion\Windo­­ws - some of the DLLs loaded there might cause the problem.
The reason you do not see it every time could be that sometimes there might be some other DLL loaded on the particular address before the DLL with the fixed address requirement is to be loaded, so the conflict only occurs then.

valgrind profile error after lib replace

I used to profile a c++ app developed with eclipse CDT using valgrind (memcheck+helgrind). The application uses a static lib (libpodofo.a). After I modified and rebuild the library(podofo) the application runs fine, but valgrind says
Launching myapp(1)" has encountered a problem. Error starting process (Cannot parse PID from output file).
I have no idea where to start. Any idea?
The error apparently occurs when it tries to make calls from the library (judging by console output).
I don't know what code I could post since app runs without error.
Library is podofo.
Found the problem.
It was the code(obviously) it was a variable that hadn't been initialized, valgrind was actually killed by a null pointer.

Deployed C++ AMP application stops responding

Im trying to deploy a C++ AMP application to another Windows 7 machine.
I have tried to include the vcamp110.dll in the same folder, and also compiled with /MT do get rid of dependency on msvcp110.dll and msvcr110.dll.
Also tried both x64 and win32 release of the application.
On the computers i have tried it on whitout VS11 installed, the program stops responding.
I tried to do a simple test with the hello world application and i have the same problems there.
The files can be downloaded from here http://www.2shared.com/file/IofZlrJs/amptest.html (source, binary and the dll).
Any suggestions to how this can be fixed?
Deployments like the one you tried are definitely supported – full details here:
http://blogs.msdn.com/b/nativeconcurrency/archive/2012/03/12/deploying-apps-built-with-c-amp.aspx
There are a few things you can do to diagnose the issue you are facing yourself:
The bitness of vcamp110.dll has to match the bitness of your app, so 32bit for one means 32bit for the other.
Ensure that there are no other instances of vcamp110.dll in some central location (e.g. system32)
Attach a debugger and see what DLLs are loaded and what exception gets thrown.
Most important of all, for all your apps, surround your parallel_for_each call with try…catch to see what runtime_exception you are getting. More on C++ AMP exceptions can be found here: http://blogs.msdn.com/b/nativeconcurrency/archive/2012/02/01/c-amp-runtime-exceptions.aspx
For the specific repro you shared, we tried that under the debugger on a clean Windows 7 machine and indeed a rutime_exception is being thrown: “The binary for the parallel_for_each is incompatible with this version of runtime.”, which indicates a mismatched runtime version (either mixing bitness or mixing Developer Preview with Beta or something like that).