Problems with running the application using OpenSSL - c++

Good day, colleagues. I'm building an application using OpenSSL - the application crashes with an error code: 0xc0000142.
The standard application openssl.exe also crashes with this error code. What could be the trouble?

According to Microsoft Support in KB 2701373:
This issue is caused by an error in the
Microsoft.powershell.consolehost.dll file. When a Windows PowerShell
script calls the Console.Write method, or when you run an executable
file for an application from a Windows PowerShell session, values are
written into the PowerShell console. Additionally, a corresponding
console handle is created. When many console handles are created, the
console handles leak, and the issue that is described in the
"Symptoms" section occurs.
There's also a question in the Microsoft Communities, CMD.EXE error 0xc0000142, and the answer appear to be "reinstall your application".
I'm not sure how MinGW affects the problem. Since MinGW is abandoned, I'm guessing its the problem and you likely won't be able to fix it. Its probably providing an old, buggy version of something with ABI problems.
Maybe you can use Cygwin for Linux on Windows. Cygwin is still actively developed and maintained.

Related

Windows 10: The application was unable to start correctly (0xc000a200)

I am developing my QT application on windows 10 . The development is complete (as for now).
After run the application in debug mode from QT-creator, I am trying to run the executable from the build directory. But it shows me an "Application Error" dialog with the following message:
The application was unable to start correctly (0xc000a200). Click OK
to close the application.
What is the problem and How to fix it ?!
The error codes are given to you in the error message for a reason. They don't mean anything to regular users, but we're programmers and we are the intended audience. Now that Google has been invented, you have absolutely no excuse for not taking the 5 seconds to Google the error code and see what it means.
In this case, 0xc000a200 is an error code that corresponds to STATUS_NOT_APPCONTAINER. The master list of COM error codes is in the Windows SDK headers, specifically ntstatus.h. If one looks this one up, one sees the following description:
This operation is only valid in the context of an app container.
Now, admittedly, once you get to this point, you may discover that you are in well over your head. You may not have any idea what an app container is, and certainly no clue about how to fix it. But at least then you would be able to ask a good question, which will go a long way to getting you a good answer.
But let's see if you can get lucky this time anyway. This error is most commonly encountered when an application that is not inside of an app container tries to load a DLL that is marked as being part of an app container. It is the linker that is responsible for marking a DLL as being or not being part of an app container, controlled by a series of options for whatever linker you're using. On Microsoft's linker, it is /APPCONTAINER:YES and /APPCONTAINER:NO that control this. I'm not sure what toolchain Qt Creator uses, but if it is not Microsoft's, this should at least get you started looking in the right place in that linker's documentation. Make sure that all DLLs used by your application are not being marked as part of an app container.
The option should be off by default for a regular C++ desktop application project, but it's possible that one of the DLLs started out life as part of a Windows Store app. Or it's possible that the switch just got thrown accidentally.
I had the same error, but the approved solution wasn't the cure. What I found is that I had installed the wrong Qt compiler support packages. For me it was Qt 5.9.1 on Windows 10 64 bit to use with Visual Studio 2017. When installing Qt I selected the "msvc2017 64-bit" option. Sound good, right? Wrong: what I wanted was the "UWP x64 (MSVC2017)".

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).

Error STATUS_BAD_NETWORK_PATH when running qt executables through developer studio

I have searched and found no answer to this
I have a weird problem when running executables through developer studio (2008): a basic 'hello world' exe works OK when created through the usual dev studio project creation mechanism, but when trying to run a library based program the software crashes with STATUS_BAD_NETWORK_PATH. The program uses Qt and zlib behind the scenes and is written in C++, but (as far as I'm aware) is not dependent on any particular network locations on initialisation; we do have Sophos installed on the PC too.
The weird thing is that one cant even step into the main: the program fails well before this with the error. If we plug the network in, it starts up just fine ... The odd thing is this only occurs on a specific 64 bit Windows 7 machine.
Does anyone have any tips as to how to trace where the issue is? We've tried tracking using procmon but it is not very revealing; no obvious failures up to the point where the program crashes.
We have now figured out the answer. It transpired that there were 2 issues:
Firstly a wrapper .bat script that was launching developer studio was setting the PATH environment variable: a location in this path was being specified using a UNX style path (e.g. \\a\location\somewhere) rather than a mapped drive. The executables were not actually using this location but when the network was unplugged this it seems that this was disrupting things from dev studio
This, in tandem with a network configuration error on the PC, meant that deep down in the runes, something was failing.
So - advice if you see such an error
Check your PATH and make sure it is sensible
Look in your PC's configuration logs, and see if you can see any networking issues
...

Problem spawning application

Gosh, this is so weird, I don't know what to say. The short version is that I have a simulator app which I spawn from my application when the user asks me to. It recently stopped working, though I can run the simulator fine from the command line or Start menu. This could be due to moving to VS2010 or Windows 7 or something I didn't notice reviewing source control diffs.
I have a second simulator which I try to spawn in the same fashion and it works fine.
By default, I'm using Qt3's QProcess wrapper around CreateProcess for this purpose, but I get the same behavior using system, my own CreateProcess, and ShellExecute.
ShellExecute of a cmd.exe "/c application params" does provide me with some more information however. I get the dialog
"The program can't start because MSVCR80.dll is missing from your computer. Try reinstalling the program to fix this problem."
Inconveniently, both the parent application and the second simulator use MSVCR80.dll.
Upon copying MSVC*80.dll from g:\windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4927_none_d08a205e442db5b5 to the same directory as my executable, the error message changes to
"Runtime Error!
Program: g:\path\to\app.exe
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application's support team for more information.
Followed by
The application was unable to start correctly (0xc0000142). Click OK to close the application.
And, once again, the application runs fine from the command line with those dlls in place.
Update:
I suspected perhaps it was environment related, so changed my ShellExecute mechanism to do cmd /c set && app params. I set up a cmd.exe with those same params and my app is now crashing similarly. Will update when I figure out why :)
It is MATLAB's component runtime tool that is modifying my process's PATH variable to bad effect. It is prepending its own dir full of dll's and wreaking havoc.
A foolish tool I was using did a setenv on PATH, prepending a directory it wanted for dynamically loading some dlls, but which messed up my application later. I ended up using GetEnvironmentStrings as shown in the last example here, erasing the first entry in the PATH env var, and sending the new (original) environment to QProcess, which wraps CreateProcessA.
You need to install the CRT
This may work - if it breaks, you get to keep both pieces :-)
Try installing VC++ redistributable from here - http://www.microsoft.com/downloads/en/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en.
Remember to backup your system, create a restore point etc. before installing stuff.
Another idea -try reinstalling the failing appliacation itself. It may come with its own copy of VC++ redistributables, and reinstalling might help. Esp. trying to reinstall it using Windows 7's compability mode (perhaps go back to Vista or XP compatibility) might be even more effective.
To reiterate - you'll have to try, and I've no real idea if either of the above ideas will do you good, or even be sure to do no harm. That said, if I were faced with a similar problem, these are the steps I'd try. HTH!

0xE0434F4D Error

all, I have a rather frustrating issue. The application in question has an MFC GUI that uses the classes available in the MFC Featurepack. This GUI uses an DLL that is developed in C++\CLI. Our company uses Cruise Control. NET (1.4.4 SP1) on Windows Server 2008 SP2 for continuous integration. Cruise Control is setup to use the version of MSBuild that comes with the 3.5 version on the framework.
The issue in question is that if I use the build that Cruise Controls creates, I receive the following error: "Unhandled exception at 0x7642fbae (kernel32.dll) in FormView.exe: 0xE0434F4D: 0xe0434f4d." After some digging, the issue seems to be that the GUI doesn't like the C++\CLI assembly.
The "gotcha" is that if I log on to the server, and, using PowerShell, execute the same MSBuild command, the build works. Any one have ideas?
The issue was how I was building the installer. It was a separate solution from the project's main solution, and was thus a separate task from the primary build. Therefore, the output assemblies got signed twice, and loader complained because the one the application wanted was no longer valid.
you could try and attach the process to the visual studio debugger.