'Unexpected Program exit with Code 0xC0000417 (Invalid C-Runtime Parameter)

After upgrading a big project to Visual Studio 2013, the program cased a crash (Program stopped working) on a normal computer.

Now when I debug this program in Visual Studio 2013, I don't see anything, except of the last message: "The program '[3948] Server.exe' has exited with code -1073740777 (0xc0000417)."

The Code is defined in "ntstatus.h" as "Invalid C-Runtime Parameter"

That's at least more, than just the "Program Stopped Working" message, I guess.

Is there any way to catch this error? As the project is overly big, and some Libraries could have changed, I have no overview over all the parameter calls in this program.

So I'm looking for a way to globally catch this error in my program in order to find out the invalid Parameter call. The program is also MFC Dialog based and does not contain a "main" method, why I couldn't find a way to globally use "_set_invalid_parameter_handler" which seems to be a C method, and not object orientatet at all.

Thank you for any help! :)



Solution 1:[1]

There may be much simpler causes, in my case a miscalculated value in _chdrive(), which turned out negative. Without explaining how, and being quite ashamed of this quite stupid bug, the outcome was not an error in _chdrive(), but unexpected program exit with code 0xc0000417 (invalid c runtime parameter), indeed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jan