I would suggest reading this two-part article on MSDN in the Win32 Portable Executable file format. It describes all the different parts of a file that give you a lot of information about what needs to happen in order to download and run an executable file.
The PE-format Wikipedia page also contains useful information.
source share