Your program is returning ErrorLevel 128 (exit code)

Here is a scenario:

  • You have written a program;
  • You run it;
  • First line of the program never gets executed;
  • ErrorLevel (exit code) 128 is returned.

You search Google for solution, but nothing useful is found. This happened to me. Problem was — Windows was running out of memory on my virtual computer. This can happen on physical machine too.

Later I found MS support article. User32.dll or Kernel32.dll fails to initialize:

Sometimes an application that is executed by either CreateProcess() or CreateProcessAsUser() fails and you receive one of the following error messages:
Initialization of the dynamic library \system32\user32.dll failed. The process is terminating abnormally.
Initialization of the dynamic library \system32\kernel32.dll failed. The process is terminating abnormally.
The failed process returns the exit code 128 or
ERROR_WAIT_NO_CHILDREN