konrad-kruczynski / elfsharp

Pure managed C# library for reading ELF, UImage, Mach-O binaries.
https://elfsharp.it
Other
159 stars 57 forks source link

ELFWriter #48

Closed mikkleini closed 3 years ago

mikkleini commented 5 years ago

I would need an ELFWriter to load, modify and save elf files. I'm a little bit thinking of implementing it but it only works out if the ELFWriter actually reads out everything, otherwise it's not possible to get same output. Can anybody comment the completeness of the reader? Or does anybody have some ideas about writer?

konrad-kruczynski commented 5 years ago

Hi @mikkleini . Since e.g. each section of the ELF file - even if not understood by the library - can have its content read in raw binary form (ISection contains the byte[] GetContents() method), you can then use it to write it verbatim to the output file. So you can start with something simply rewriting all sections and segments. Having said that, it is worth noting that the currently implement model works not reading everything and having it in memory, it is a lazy one, so that each section/segment is read when it's retrieved.

The internal constructor of the ELF class might be a good place to start when creating ELFWriter.

konrad-kruczynski commented 3 years ago

Hi @mikkleini . I'm now about to close this ticket as the feature won't be implemented in the nearest future unless someone comes up with a pull request. Please reopen if necessary.