ShGetFileInfo called for directory oddity

Posted by Axarydax on Stack Overflow See other posts from Stack Overflow or by Axarydax
Published on 2010-03-17T15:17:04Z Indexed on 2010/03/23 15:23 UTC
Read the original article Hit count: 234

Filed under:
|
|
|

Hello, I have a simple file browser and there I display files and folders,

obtained by (for directory)

SHFILEINFO info = new SHFILEINFO();
SHGetFileInfo(filename,
FILE_ATTRIBUTE_DIRECTORY,
ref info,Marshal.SizeOf(info),
SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_ADDOVERLAYS);

It works 100% fine, but I have noticed an oddity - if I try to obtain an icon for directory, but specify FILE_ATTRIBUTE_NORMAL instead of FILE_ATTRIBUTE_DIRECTORY but it does weird stuff for directories - normal folders have "unknown file type white paper" icons, recycle bin has VLC icon, etc. Directories under SVN have proper overlay, but base file icon (white sheet of paper).

I understand that base icon for directory would now be the one of unknown file, but why do some folders have totally strange icon? Config.MSI has installer icon, recycle bin has VLC icon (wtf?!), etc. What does the shell function do with this parameters? Exactly what icon does it obtain?

Again, this is not a problem, I'm just curious.

© Stack Overflow or respective owner

Related posts about shell32

Related posts about Icons