Where are exception codes documented for microsoft applications? - c++

I am running an application compiled with MSVC, I am experiencing an exception that is being caught and reported as Exception=0xc000008f. The application is written in C++;
Can someone help me find where these exception codes are documented?
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\excpt.h

The main place to look is the winerror.h file shipped in the SDK. (Usually found at c:\program files (x86)\Windows Kits\10\Include<version>\share\winerror.h). Sometimes the constants will be found in other files either also in shared or sometimes in um.
I tend to use a command line grep for performing such searches, though the Visual Studio "find in files" can also be made to search the include paths.
I will add that the exact error you ask about is called "ATUS_FLOAT_INEXACT_RESULT" and is defined in ntstatus.h rather than winerror.h

Related

"The package System.Net.Http with version 4.1.1 could not be found in C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\."

I am trying to evaluate a software SDK for displaying PDF files. It comes with a few sample projects, but I am having problems building the C++ projects. I am pretty sure this is a problem with my local environment, but I have no idea how to fix it:
The projects come as a Visual Studio solution, to be used in Visual Studio 2017. Upon first opening it I was told to install missing features (VS17 was a plain install with no workloads before):
After installing that, and twiddling with platform toolset and the general platform target settings, I could finally build the C++ library part that creates a .dll file to be used by the other 2 C++ projects. (I could also confirm that this works fine, as the also included C# project used the library perfectly fine.)
But for the 2 remaining C++ projects I get this error on build:
The package System.Net.Http with version 4.1.1 could not be found in C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\. Run a NuGet package restore to download the package.
FunctionDemo
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets
377
Unfortunately I have no idea what "Use NuGet Package Restore to download them." means in that context - both the solution and all the projects have nothing listed when using Manage NuGet Packages... in Visual Studio. So I don't even know where this dependency comes from. (Are those part of the general SDKs I have installed maybe?)
Double clicking the error message opens C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets with this:
<ResolveNuGetPackageAssets Condition="Exists('$(FrameworkInjectionLockFile)')"
NuGetPackagesDirectory="$(FrameworkInjectionPackagesDirectory)"
RuntimeIdentifier="$(NuGetRuntimeIdentifier)"
TargetMonikers="$(NuGetTargetMonikerToInject)"
ProjectLockFile="$(FrameworkInjectionLockFile)">
But I guess this is pretty standard. Does this tell me something where the error comes from?
On the filesystem C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\System.Net.Http\4.1.1 indeed does not exist. Any tries to fill it manually (download the nuget package manually to a project, and copying the results here, using any solutions or commands to run I can find online) failed.
If found out that C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ is the package source Microsoft Visual Studio Offline Packages which I can view via Options -> NuGet Package Manager -> Package Sources in Visual Studio 2017, but disabling it there didn't change anything about the error message.
Am I looking in the wrong place?
Is this really my local problem or a project problem?
How can I fix this problem?
I "fixed" this by getting the C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\System.Net.Http\4.1.1 folder from another developer. Then the error message switched to other packages, so in the end he sent me his full C:\Program Files (x86)\Microsoft SDKs\NuGetPackages and I copied folders over until it finally built.
Still not idea what caused this, must have been a missing payload or SDK that Visual Studio thinks was installed but really wasn't :/
Keeping the question unanswered though in the hopes that someone comes along that know the real fix.
This happened to me after upgrading from Visual Studio 2017 to 2019. While not the same file, my error was:
error APPX0702: Payload file 'C:\Program Files (x86)\Microsoft
SDKs\NuGetPackages\System.Private.ServiceModel\4.1.3\runtimes\win7\lib\netcore50\System.Private.ServiceModel.dll'
does not exist.
For whatever reason, after upgrading, both VS 2017 and VS 2019 were looking for this in C:\Program Files (x86)\Microsoft SDKs\NuGetPackages..., but I found it actually existed in the similarly named folder C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages... instead. I assume during the installation of VS 2019 this directory was created?
I manually copied the files over to where it was looking and then the build finally worked. The underlying issue isn't fixed, but maybe somebody smarter than me can explain why this happened in the first place.
For me disabling C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ didn't work either. But then I had deleted it from Nuget.Config and it had finally solved the problem.

Using fopen on a directory on windows

I am trying to get the correct error code out of errno when opening a directory as a file, both with fopen as well as with ifstream.open(). I expect EISDIR, I get EACCES.
I am compiling (and executing) with the MSVC 12.0 toolchain on Windows 7 x64.
I have been reading in article (https://gehrcke.de/2011/06/reading-files-in-c-using-ifstream-dealing-correctly-with-badbit-failbit-eofbit-and-perror/) where the author got the output "stream failbit (or badbit). error state: Is a directory".
I compiled the authors files with GCC 4.6 (or above, not sure atm) and on passing a directory as argument I get EACCES as well.
I know there is no easy way of telling whether a disk object is a directory on windows, so not getting EISDIR is not too surprising.
Is there anything that can be done about it (getting EISDIR on windows, that is)?
Are there other errno's that behave in a similar (unexpected) way?
Microsoft's C runtime libraries define, but do not use the EISDIR symbol. So you won't get that error code from them. To get the answer to your other question, you need to look in the C library source code. It ships with Visual Studio and, in case of Visual Studio 2015 and later, Windows SDK.
In Visual Studio 2015 (14.0), which uses the Universal CRT, the file you want is called errno.cpp and it's included in the Windows SDK, I have it in c:\Program Files (x86)\Windows Kits\10\Source\10.0.10586.0\ucrt\misc\errno.cpp.
In Visual Studio 2013 (12.0), the file you want is called dosmap.c and it's included in the VC subdirectory of the Visual Studio installation directory, I have it in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\crt\src\dosmap.c.
Both of those files contain an error table mapping OS error codes to C library error codes. You can use it to confirm whether a particular mapping conforms to your expectations.
The fopen function isn't a part of the Windows API; it comes from the run-time support library from some given C or C++ development environment.
This EISDIR error works in a C application built for Cygwin and shipped with Cygnal:
c:\users\kaz>txr
This is the TXR Lisp interactive listener of TXR 148.
Use the :quit command or type Ctrl-D on empty line to exit.
1> (open-file ".")
#<file-stream . 6fffff00738>
2> (get-string *1)
** error reading #<file-stream . 6fffff00738>: 21/"Is a directory"
** during evaluation at expr-2:1 of form (get-string *1)
3>
The open-file function in this language uses fopen, and get-string ultimately relies on C stdio.h functions. The fopen succeeds, but the subsequent input attempt receives the EISDIR error. (Mapped to the same traditional 21 code as on Linux and other platforms). That is turned into an exception. The "Is a directory" string is from strerror.
You just need a more richly featured C run-time library with better POSIX support than the paltry offering provided with Microsoft Visual Studio.

Where is cdb.exe located in Visual Studio 2013?

I'm trying to configure a debugger for Qt Creator. However, I can't find cdb.exe. From internet, I found out that it is supposed to be located in C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x64\cdb.exe. Yet, I don't have directory C:\Program Files (x86)\Windows Kits\8.0\Debuggers. I do have a directory called C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x64 but it only contains files dbghelp.dll, srcsrv.dll and symsrv.dll.
cdb.exe and the gui equivalent windbg.exe are part of the debugging tools for windows and have to be downloaded as part of the windows SDK, in the past it has been part of the DDK also.
You can get it here: https://msdn.microsoft.com/en-us/windows/hardware/hh852365.aspx
If you're just interested in the tools there is a link for the standalone debugging tools (as part of windows 8.1 SDK) here: https://www.microsoft.com/click/services/Redirect2.ashx?CR_EAC=300135395
dbghelp.dll, srcsrv.dll and symsrv.dll are shipped as part of Windows and has been since Windows 2000 (I think this is certainly true of dbghelp.dll).

lpsolve errors when attempting to run

I am trying to use lpsolve for optimisation in MS Visual C++ 2010. However, I have attempted to follow the instructions on linking the libraries but I still get errors when trying to run the demo available on the lpsolve site.
I am on a 64-bit system, but I can only make a console 32 application
in VS2010
I have placed the lpsolve55.dll in both System32 and SysWOW64
I have put all the header files in C:\Program Files (x86)\Microsoft
Visual Studio 10.0\VC\include
I have put all the library files and the dll in C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\lib
In the project preferences, linker, additional dependencies I have
listed lpsolve55.lib
Using the win32 lpsolve archive,
The demo compiles, but then throws the following error as soon as it runs:
"Unhandled exception at 0x77b98e19 in lpsolveDEMO.exe: 0xC0000005: Access violation writing location 0x00000014."
I have no experience adding libraries or using any really other than the stdio library. Any help would be greatly appreciated, or any suggestions for more straightforward to use linear optimisation libraries as I can't find any tutorial on lpsolve other than this demo that doesn't work

VS 2010 C++ cannot load msobj100.dll in Release mode

I have a fairly simple C++ project in Visual C++ 2010 Express on Windows 7. I have no problems compiling in Debug mode for Win32, but when I switch to Release mode for Win32 I get the following compiler error:
LINK : fatal error LNK1296: unable to load msobj100.dll
I know this question has been asked here, but I couldn't get a fix from that solution. I did a search for that file, and it is only located in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE. Within SysWOW64 and Win32, there are files called 'msobjs.dll', but that's it. Any ideas?
Try to install the Windows SDK to your computer. These Files Should be distributed.Along with it.
See here.
Copy the missing dll file from
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
to
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin.
VC\Bin is the runtime path.
This problem also bothered me for a long time, and I had to run Release mode in another machine...
and I find the solution just now.