I analyze malware and much of the time, I get this error. What are some causes of this error? I inspect the file in HxD and many times, the PE header seems to be intact, I also try on x64 and x86.
Maybe if you post a sample and we can see which headers look bad.
Any any rate here is a list of some relevant NT status codes:
0x4000000E
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
{Machine Type Mismatch} The image file %hs is valid but is for a machine type other than the current machine. Select OK to continue, or CANCEL to fail the DLL load.
0x40000023
STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE
{Machine Type Mismatch} The image file %hs is valid but is for a machine type other than the current machine.
0xC000007B
STATUS_INVALID_IMAGE_FORMAT
{Bad Image} %hs is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support.
0xC000012E
STATUS_INVALID_IMAGE_LE_FORMAT
The specified image file did not have the correct format: it appears to be LE format.
0xC000012F
STATUS_INVALID_IMAGE_NOT_MZ
The specified image file did not have the correct format: it did not have an initial MZ.
0xC0000130
STATUS_INVALID_IMAGE_PROTECT
The specified image file did not have the correct format: it did not have a proper e_lfarlc in the MZ header.
0xC0000131
STATUS_INVALID_IMAGE_WIN_16
The specified image file did not have the correct format: it appears to be a 16-bit Windows image.
0xC00001A3
STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT
The subsystem needed to support the image type is not present.
0xC0000221
STATUS_IMAGE_CHECKSUM_MISMATCH
{Bad Image Checksum} The image %hs is possibly corrupt. The header checksum does not match the computed checksum.
0xC0000249
STATUS_IMAGE_MP_UP_MISMATCH
{UP/MP Image Mismatch} The image %hs has been modified for use on a uniprocessor system, but you are running it on a multiprocessor machine. Reinstall the image file.
0xC0000251
STATUS_BAD_DLL_ENTRYPOINT
{Invalid DLL Entrypoint} The dynamic link library %hs is not written correctly. The stack pointer has been left in an inconsistent state. The entry point should be declared as WINAPI or STDCALL. Select YES to fail the DLL load. Select NO to continue execution. Selecting NO might cause the application to operate incorrectly.
0xC0000359
STATUS_INVALID_IMAGE_WIN_32
The specified image file did not have the correct format; it appears to be a 32-bit Windows image.
0xC000035A
STATUS_INVALID_IMAGE_WIN_64
The specified image file did not have the correct format; it appears to be a 64-bit Windows image.