public static extern int SHGetStockIconInfo(SHSTOCKICONID siid, SHGSI uFlags, ref SHSTOCKICONINFO psii);
        protected virtual Image GetVolumeIcon(VolumeType volumeType, char driveChar, ref Size size)
        {
            int iconIndex = 0;
            SHSTOCKICONID siid = SHSTOCKICONID.SIID_DRIVEUNKNOWN;
            switch (volumeType)
            {
                case VolumeType.Removable:
                    if ((driveChar != 'A') && (driveChar != 'B'))
                    {
                        iconIndex = 7;
                        siid = SHSTOCKICONID.SIID_DRIVEREMOVE;
                        break;
                    }
                    iconIndex = 6;
                    siid = SHSTOCKICONID.SIID_DRIVE35;
                    break;

                case VolumeType.Fixed:
                    iconIndex = 8;
                    siid = SHSTOCKICONID.SIID_DRIVEFIXED;
                    break;

                case VolumeType.Network:
                    iconIndex = 9;
                    siid = SHSTOCKICONID.SIID_DRIVENET;
                    break;

                case VolumeType.CDRom:
                    iconIndex = 11;
                    siid = SHSTOCKICONID.SIID_DRIVECD;
                    break;

                case VolumeType.Ram:
                    iconIndex = 12;
                    siid = SHSTOCKICONID.SIID_DRIVERAM;
                    break;

                case VolumeType.DVDRom:
                    iconIndex = 0xb1;
                    siid = SHSTOCKICONID.SIID_DRIVEDVD;
                    break;

                case VolumeType.Floppy3:
                    iconIndex = 6;
                    siid = SHSTOCKICONID.SIID_DRIVE35;
                    break;

                case VolumeType.Floppy5:
                    iconIndex = 5;
                    siid = SHSTOCKICONID.SIID_DRIVE525;
                    break;

                case VolumeType.Flash:
                    iconIndex = OS.IsWinXP ? 0xbd : 7;
                    siid = SHSTOCKICONID.SIID_MEDIACOMPACTFLASH;
                    break;
            }
            if (OS.IsWinVista)
            {
                SHSTOCKICONINFO shstockiconinfo;
                shstockiconinfo = new SHSTOCKICONINFO {
                    cbSize = Marshal.SizeOf(shstockiconinfo)
                };
                if (HRESULT.SUCCEEDED(Shell32.SHGetStockIconInfo(siid, SHGSI.SHGSI_ICONLOCATION, ref shstockiconinfo)))
                {
                    return LoadIconFromLocation2(new IconLocation(shstockiconinfo.szPath, shstockiconinfo.iIcon), ref size);
                }
            }
            return LoadShellDllIcon(iconIndex, size);
        }
        public override Image GetDefaultIcon(DefaultIcon icon, Size size)
        {
            Image image;
            if (OS.IsWinVista)
            {
                SHSTOCKICONID siid = SHSTOCKICONID.SIID_INVALID;
                switch (icon)
                {
                    case DefaultIcon.UnknownFile:
                        siid = SHSTOCKICONID.SIID_DOCNOASSOC;
                        break;

                    case DefaultIcon.DefaultDocument:
                        siid = SHSTOCKICONID.SIID_DOCASSOC;
                        break;

                    case DefaultIcon.DefaultApplication:
                        siid = SHSTOCKICONID.SIID_APPLICATION;
                        break;

                    case DefaultIcon.Drive:
                        siid = SHSTOCKICONID.SIID_DRIVEUNKNOWN;
                        break;

                    case DefaultIcon.Folder:
                        siid = SHSTOCKICONID.SIID_FOLDER;
                        break;

                    case DefaultIcon.MyComputer:
                        siid = SHSTOCKICONID.SIID_DESKTOPPC;
                        break;

                    case DefaultIcon.NetworkNeighborhood:
                        siid = SHSTOCKICONID.SIID_WORLD;
                        break;

                    case DefaultIcon.EntireNetwork:
                        siid = SHSTOCKICONID.SIID_MYNETWORK;
                        break;

                    case DefaultIcon.NetworkServer:
                        siid = SHSTOCKICONID.SIID_SERVER;
                        break;

                    case DefaultIcon.NetworkFolder:
                        siid = SHSTOCKICONID.SIID_SERVERSHARE;
                        break;

                    case DefaultIcon.OverlayLink:
                        siid = SHSTOCKICONID.SIID_LINK;
                        break;

                    case DefaultIcon.OverlayShare:
                        siid = SHSTOCKICONID.SIID_SHARE;
                        break;
                }
                if (siid != SHSTOCKICONID.SIID_INVALID)
                {
                    SHSTOCKICONINFO shstockiconinfo;
                    shstockiconinfo = new SHSTOCKICONINFO {
                        cbSize = Marshal.SizeOf(shstockiconinfo)
                    };
                    if (HRESULT.SUCCEEDED(Shell32.SHGetStockIconInfo(siid, SHGSI.SHGSI_ICONLOCATION, ref shstockiconinfo)))
                    {
                        return LoadIconFromLocation2(new IconLocation(shstockiconinfo.szPath, shstockiconinfo.iIcon), ref size);
                    }
                }
            }
            switch (icon)
            {
                case DefaultIcon.UnknownFile:
                    return GetDefaultContainerIcon("Unknown", 0, ref size);

                case DefaultIcon.DefaultDocument:
                    return LoadShellDllIcon(1, size);

                case DefaultIcon.DefaultApplication:
                    return LoadShellDllIcon(2, size);

                case DefaultIcon.Desktop:
                    return LoadShellDllIcon(0x22, size);

                case DefaultIcon.Drive:
                    return GetDefaultContainerIcon("Drive", 8, ref size);

                case DefaultIcon.Favorites:
                    return GetClsidIcon(CLSID.CLSID_FAVORITES, 0x2b, size);

                case DefaultIcon.Folder:
                    return GetDefaultContainerIcon("Folder", 3, ref size);

                case DefaultIcon.MyComputer:
                    return GetClsidIcon(CLSID.CLSID_MYCOMPUTER, 15, size);

                case DefaultIcon.MyDocuments:
                    return GetClsidIcon(CLSID.CLSID_MYDOCUMENTS, OS.IsWinXP ? -235 : 20, size);

                case DefaultIcon.MyPictures:
                case DefaultIcon.MyMusic:
                case DefaultIcon.MyVideos:
                    if (!OS.IsWinXP)
                    {
                        goto Label_0282;
                    }
                    image = null;
                    switch (icon)
                    {
                        case DefaultIcon.MyPictures:
                            image = LoadShellDllIcon(-236, size);
                            break;

                        case DefaultIcon.MyMusic:
                            image = LoadShellDllIcon(-237, size);
                            break;

                        case DefaultIcon.MyVideos:
                            image = LoadShellDllIcon(-238, size);
                            break;
                    }
                    break;

                case DefaultIcon.SearchFolder:
                    return LoadShellDllIcon(0x2d, size);

                case DefaultIcon.NetworkNeighborhood:
                    return GetClsidIcon(CLSID.CLSID_NETWORK_NEIGHBORHOOD, 0x11, size);

                case DefaultIcon.EntireNetwork:
                    return LoadShellDllIcon(13, size);

                case DefaultIcon.NetworkWorkgroup:
                    return LoadShellDllIcon(0x12, size);

                case DefaultIcon.NetworkProvider:
                    return LoadShellDllIcon(14, size);

                case DefaultIcon.NetworkServer:
                    return LoadShellDllIcon(15, size);

                case DefaultIcon.NetworkFolder:
                    if (!OS.IsWinME && !OS.IsWin2k)
                    {
                        return GetDefaultContainerIcon("Folder", 3, ref size);
                    }
                    return LoadShellDllIcon(-172, size);

                case DefaultIcon.OverlayLink:
                    return LoadShellDllIcon(0x1d, size);

                case DefaultIcon.OverlayShare:
                    return LoadShellDllIcon(0x1c, size);

                case DefaultIcon.OverlayUnreadable:
                    return null;

                default:
                    throw new InvalidEnumArgumentException();
            }
            if (image != null)
            {
                return image;
            }
        Label_0282:
            return GetDefaultContainerIcon("Folder", 3, ref size);
        }
        public override Image GetDefaultIcon(DefaultIcon icon, Size size)
        {
            Image specialFolderIcon = null;
            IDictionary<Size, Image> dictionary;
            Dictionary<DefaultIcon, IDictionary<Size, Image>> dictionary2;
            lock ((dictionary2 = this.DefaultIconCache))
            {
                if (this.DefaultIconCache.TryGetValue(icon, out dictionary))
                {
                    if (dictionary == null)
                    {
                        return null;
                    }
                    if (dictionary.TryGetValue(size, out specialFolderIcon))
                    {
                        return specialFolderIcon;
                    }
                }
            }
            if (OS.IsWinVista)
            {
                SHSTOCKICONID siid = SHSTOCKICONID.SIID_INVALID;
                switch (icon)
                {
                    case DefaultIcon.UnknownFile:
                        siid = SHSTOCKICONID.SIID_DOCNOASSOC;
                        break;

                    case DefaultIcon.DefaultDocument:
                        siid = SHSTOCKICONID.SIID_DOCASSOC;
                        break;

                    case DefaultIcon.DefaultApplication:
                        siid = SHSTOCKICONID.SIID_APPLICATION;
                        break;

                    case DefaultIcon.Drive:
                        siid = SHSTOCKICONID.SIID_DRIVEUNKNOWN;
                        break;

                    case DefaultIcon.Folder:
                        siid = SHSTOCKICONID.SIID_FOLDER;
                        break;

                    case DefaultIcon.MyComputer:
                        siid = SHSTOCKICONID.SIID_DESKTOPPC;
                        break;

                    case DefaultIcon.NetworkNeighborhood:
                        siid = SHSTOCKICONID.SIID_WORLD;
                        break;

                    case DefaultIcon.EntireNetwork:
                        siid = SHSTOCKICONID.SIID_MYNETWORK;
                        break;

                    case DefaultIcon.NetworkServer:
                        siid = SHSTOCKICONID.SIID_SERVER;
                        break;

                    case DefaultIcon.NetworkFolder:
                        siid = SHSTOCKICONID.SIID_SERVERSHARE;
                        break;

                    case DefaultIcon.OverlayLink:
                        siid = SHSTOCKICONID.SIID_LINK;
                        break;

                    case DefaultIcon.OverlayShare:
                        siid = SHSTOCKICONID.SIID_SHARE;
                        break;
                }
                if (siid != SHSTOCKICONID.SIID_INVALID)
                {
                    SHSTOCKICONINFO shstockiconinfo;
                    shstockiconinfo = new SHSTOCKICONINFO {
                        cbSize = Marshal.SizeOf(shstockiconinfo)
                    };
                    if (HRESULT.SUCCEEDED(Shell32.SHGetStockIconInfo(siid, SHGSI.SHGSI_ICON | ((size.Height < 0x20) ? SHGSI.SHGSI_SMALLICON : SHGSI.SHGSI_ICONLOCATION), ref shstockiconinfo)))
                    {
                        specialFolderIcon = IconToImage(shstockiconinfo.hIcon);
                    }
                }
            }
            if (specialFolderIcon == null)
            {
                switch (icon)
                {
                    case DefaultIcon.OverlayLink:
                    case DefaultIcon.OverlayShare:
                    case DefaultIcon.OverlayUnreadable:
                        return null;

                    case DefaultIcon.UnknownFile:
                        break;

                    case DefaultIcon.DefaultDocument:
                        specialFolderIcon = this.GetIcon("file.txt", FileAttributes.Normal, true, ref size);
                        break;

                    case DefaultIcon.DefaultApplication:
                        specialFolderIcon = this.GetIcon("file.exe", FileAttributes.Normal, true, ref size);
                        break;

                    case DefaultIcon.Desktop:
                        specialFolderIcon = this.GetIcon("file.desklink", FileAttributes.Normal, true, ref size);
                        break;

                    case DefaultIcon.Drive:
                        specialFolderIcon = this.GetIcon(@"c:\", FileAttributes.Directory, true, ref size);
                        break;

                    case DefaultIcon.Favorites:
                        specialFolderIcon = this.GetIcon(Environment.GetFolderPath(Environment.SpecialFolder.Favorites), 0, false, ref size);
                        break;

                    case DefaultIcon.Folder:
                    case DefaultIcon.MyPictures:
                    case DefaultIcon.MyMusic:
                    case DefaultIcon.MyVideos:
                    case DefaultIcon.NetworkWorkgroup:
                    case DefaultIcon.NetworkProvider:
                    case DefaultIcon.NetworkFolder:
                        specialFolderIcon = this.GetIcon("folder", FileAttributes.Directory, true, ref size);
                        break;

                    case DefaultIcon.MyComputer:
                    case DefaultIcon.NetworkServer:
                        specialFolderIcon = GetSpecialFolderIcon(Shell32.GetClsidFolderParseName(CLSID.CLSID_MYCOMPUTER), ref size);
                        break;

                    case DefaultIcon.MyDocuments:
                        specialFolderIcon = GetSpecialFolderIcon(Shell32.GetClsidFolderParseName(CLSID.CLSID_MYDOCUMENTS), ref size);
                        break;

                    case DefaultIcon.SearchFolder:
                        specialFolderIcon = GetSpecialFolderIcon(Shell32.GetClsidFolderParseName(CLSID.CLSID_SEARCHRESULTS), ref size);
                        break;

                    case DefaultIcon.NetworkNeighborhood:
                        specialFolderIcon = GetSpecialFolderIcon(Shell32.GetClsidFolderParseName(CLSID.CLSID_NETWORK_NEIGHBORHOOD), ref size);
                        break;

                    case DefaultIcon.EntireNetwork:
                        if (OS.IsWinVista)
                        {
                            specialFolderIcon = GetSpecialFolderIcon(Shell32.GetClsidFolderParseName(CLSID.CLSID_NETWORK), ref size);
                        }
                        else
                        {
                            specialFolderIcon = GetSpecialFolderIcon(Shell32.GetClsidFolderParseName(CLSID.CLSID_NETWORK_NEIGHBORHOOD) + Path.DirectorySeparatorChar + "EntireNetwork", ref size);
                        }
                        break;

                    default:
                        throw new InvalidEnumArgumentException();
                }
                if (specialFolderIcon == null)
                {
                    specialFolderIcon = this.GetIcon("unknown", FileAttributes.Normal, true, ref size);
                }
            }
            lock ((dictionary2 = this.DefaultIconCache))
            {
                if (dictionary != null)
                {
                    dictionary.Add(size, specialFolderIcon);
                }
                else
                {
                    dictionary = IconCollection.Create();
                    dictionary.Add(size, specialFolderIcon);
                    this.DefaultIconCache.Add(icon, dictionary);
                }
            }
            return specialFolderIcon;
        }