In PE (for windows) it is possible to read the headers/sections of that structure by #include<windows.h>
and can use the struct PIMAGE_DOS_HEADER
to read the dos header in any PE file, for example.
How can i do that for ELF header in FreeBSD/Linux? What kind of preprocessor need to be added at the head of the C/C++ code? and Is there any difference between FreeBSD and Linux in term of the structure of ELF?
You're looking for libelf.
Look at the sources of readelf. Or just google. For example, this http://www.scribd.com/doc/7027807/ELF-Format looks promising.
If you just want existing code, try http://www.linux.com/learn/docs/man/2838-elf5.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With