3 ms·
You can edit disassembled code in your decompiler, though I'm not aware of a decompiler that lets you edit decompiled code. And editing a disassembly is tricky
by NobodyNada 2y ago
You can edit disassembled code in your decompiler, though I'm not aware of a decompiler that lets you edit decompiled code. And editing a disassembly is tricky because you need to make sure your patch is exactly the same size as the original code, otherwise the addresses won't line up.
The usual approach for a non-trivial patch is exactly what the OP did here: put your patch somewhere in free space, and replace the original sequence of instructions with a jump to your patch.
- poincaredisk 2y ago>though I'm not aware of a decompiler that lets you edit decompiled code DnSpy lets you do this (that's why I was careful to prefix decompilers with "native"in my answer). You can edit snippets of decompiled C# code directly inside. But vm based runtimes are much easier to decompile/recompile, and it still may not work in the end. Though programs compiled to intermediate code are in general very different to analyze, so that's kind of nitpicking.
- Karliss 2y agoFor C# and Java sure. Those are relatively easy to decompile and the decompilers are quite reliable. With exception of features like generator functions and lambdas most of the languages map 1:1 from source to bytecode, type information is mostly maintained. With C and C++ things are a lot harder.