Q: How does Windows explorer know which icons to display? Or put in other words: where is the icons of program files stored? I have read something about specific icon files, but I figure if that's where they're stored, there still has to be some reference in the program to the icon file where the icon is stored. Otherwise explorer wouldn't know where to look for the icon?

A: Custom icons for windows explorer are stored in the desktop.ini file inside each folder. 
The icon itself is described with the IconResource tag.
Ill include an example but you can read about it on TechNet
Example Below:
[.ShellClassInfo]
IconResource=c:\SomeFolder\SomeIcon.ico


A: The icons for program files are stored in the exe files themselves. Windows explorer just extracts them from the embedded resources in the binary file. For non executable files it is a different story. 
