0

How to overcome the error message while trying to open the exe in ILSpy:

System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
   at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders(UInt16& subsystem, UInt16& dll_characteristics)
   at Mono.Cecil.PE.ImageReader.ReadImage()
   at Mono.Cecil.PE.ImageReader.ReadImage(Disposable`1 stream, String file_name)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at ICSharpCode.ILSpy.LoadedAssembly.LoadAssembly(Object state)
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

Is the executable packed or what to do?

4
  • What about you posting the exe so we can know what's wrong in your particular case?
    – user202729
    Commented Dec 1, 2018 at 13:30
  • (either the exe is corrupted, or ILSpy cannot read it)
    – user202729
    Commented Dec 1, 2018 at 13:30
  • By the way: it suffices to tag the question with appropriate tags. It's not necessary to put (ILSpy) in the title.
    – user202729
    Commented Dec 1, 2018 at 13:31
  • Are you sure it's a .net binary?
    – Remko
    Commented Aug 6, 2019 at 10:46

1 Answer 1

1

If the program runs, it should be possible to dump the module from memory, after it was reconstructed to original state while loading it to memory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.