Different icons for files with same extension but different content?
You are looking for Icon Handler. It is implemented as a shell extension. Unfortunately, MSDN does not give any icon-handler-specific sample code, but at least this article describes requirements for such shell extension. This article also can be useful: Creating Shell Extension Handlers.