I have a PE which I'd like to edit. I know I can create patches in OllyDbg and similar tools, but they all have one thing in common: I have to overwrite some present code in file. I wonder if it is possible to somehow enlarge the executable, put the code in the appended part, and then just change a few instructions in original part to jmp to the new part? I searched over the Internet, but I haven't found an obvious solution (well, some propose writing code in NOP sections, but my code i longer than the longest of them).

Note that the PE is 64-bit, so the solution must work for this architecture.

1 Answer 1


Yes, you can add a new section to your PE file.

High-level instructions at Adding sections to PE Files and low-level instructions at Inject your code to a Portable Executable file.

  • Also, related post on this site (though not a duplicate) - Add Section to pe file function error Jul 1, 2015 at 18:13
  • The thing I eventually went by was adding a new section in PELord at the very end and put my code there.
    – sarka
    Jul 5, 2015 at 23:40

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.