Ways of repairing damaged trojan files for study and prevention purposes

What are the possible ways of repairing damaged trojan files if any, and what are the steps included in order to study the structure of trojan files so as to avoid future vulnerabilities of trojan attacks?
