Common Process Termination Values


When your application does something the OS (or the application itself) doesn’t like, often the floor gets yanked out and the process is terminated in an abrupt manner. If you don’t happen to be running with a debugger, often the easiest way to get an idea of what went wrong is to look at the process exit code. Here we have an assortment of some of the more frequently encountered exit codes you are likely to witness:

0x00000003

CRT’s abort() or assert() was called.

0x80000003

An unhandled breakpoint (such as __debugbreak()), may also be caused by /RTC run-time checks.

0xC0000005

Access violation.

0xC00000FD

Stack overflow. Avoid recursion, move large stack buffers onto the heap, or increase the stack size via the /STACK linker option.

0xC0000135

A required DLL was not found. Make sure you deploy all necessary components.

0xC0000138

An API is missing from the loaded DLL (searched by ordinal). This, and the one below, is typically due to running on an older version of Windows. You can change your _WIN32_WINNT, _WIN32_IE, etc. defines to target a previous version, or use LoadLibrary/GetProcAddress on the specific new API.

0xC0000139

An API is missing from the loaded DLL (searched by name).

0xC0000142

DllMain (from a required library) returned FALSE.

0xC0000374

Heap corruption detected (via HeapSetInformation‘s HeapEnableTerminationOnCorruption option).

0xC0000409

Stack corruption detected (typically a result of /GS stack checks).

0xC0000417

Invalid CRT parameter (typically a result of the safe CRT functions failing a check).

The 0xC… values are NTSTATUS codes, so if you happen to see other values in that range you know where to look them up.

 

Comments (2)

  1. MD_EXCH says:

    I'm seeing 0xc0000417 error with swprintf_s function. It fails with a larget buffer of say 1GB. Can you elaborate on the meaning of the error.

  2. Josh Poley says:

    @MD_EXCH

    If the size of the information you try to store in the buffer exceeds the size of the buffer, you can get 0xC0000417. For example:

    #include <stdio.h>

    int main(int, char**)
     {
     wchar_t buffer[5];
     swprintf_s(buffer, 5, L"hello world");
     return 0;
     }

    There may be other checks involved, you can always step through the CRT to see where exactly you are failing.

Skip to main content