11

I'm using the GetExitCodeProcess API to determine the exit reason for a process.

When my process fails, I get the error code -1073741502.

How can this value be converted into a value that I could google for?

Thank you.

Edit: Well, 1073741502 appears on Google, but not -1073741502. Why does my error code have a minus?

AntonioC
  • 437
  • 2
  • 5
  • 16
  • 3
    `-1073741502` when printed as hexadecimal is `c0000142` which [according to this](https://support.microsoft.com/en-us/kb/191991) means "DLL Initialization Failed". Please follow the link to read about the cause and possible solutions. – Some programmer dude Jul 07 '16 at 13:19
  • Possible duplicate of [Decode HResult = -2147467259](http://stackoverflow.com/questions/22493524/decode-hresult-2147467259) – theB Jul 07 '16 at 13:21
  • Incidentally, the output of GetExitCodeProcess is a `DWORD` which is `unsigned int`. You must have accidentally printed it as `signed int` instead, that's why you get the minus sign. – Harry Johnston Jul 09 '16 at 04:16
  • 3
    -1073741502 doesn't appear on google because the minus prefix excludes a search term which in turn means you're searching for an empty string and thus don't get any results. If you wrap the number with quotes "-1073741502" you'll get results. – voneiden Jan 20 '17 at 08:05

2 Answers2

15

Converted to hexadecimal, the value is 0xC0000142.
Windows NTSTATUS values show that your error code is STATUS_DLL_INIT_FAILED which is:

{DLL Initialization Failed} Initialization of the dynamic link library %hs failed. The process is terminating abnormally.

2

Ordinarily, return-codes consist of several bit-fields. If I've done my math correctly, this translates to 0xffffffffc0000142 which probably consists of a group 0xc0000 and error-code 0x0142. If you're Googling for a code, also search for the hex string.

And, sure enough, that produces a hit. There's even a StackOverflow entry that seems to directly address your problem:

CreateProcess succeeds, but GetExitCodeProcess returns C0000142

Community
  • 1
  • 1
Mike Robinson
  • 8,490
  • 5
  • 28
  • 41