Created
February 3, 2024 08:40
-
-
Save smourier/bc68c3d38e8cf182e3544999dd77b0f4 to your computer and use it in GitHub Desktop.
Dump the list of Shell Icon Overlay Identifiers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main() | |
{ | |
using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers", false)) | |
{ | |
foreach (var name in key.GetSubKeyNames()) | |
{ | |
Console.WriteLine("'" + name + "'"); | |
using (var sub = key.OpenSubKey(name, false)) | |
{ | |
if (!(sub.GetValue(null) is string def) || !Guid.TryParse(def, out var clsid)) | |
continue; | |
Console.WriteLine(" clsid:" + clsid); | |
var type = Type.GetTypeFromCLSID(clsid, false); | |
if (type == null) | |
continue; | |
IShellIconOverlayIdentifier identifier; | |
try | |
{ | |
identifier = Activator.CreateInstance(type) as IShellIconOverlayIdentifier; | |
} | |
catch | |
{ | |
continue; | |
} | |
var sb = new StringBuilder(256); | |
if (identifier.GetOverlayInfo(sb, sb.Capacity, out var index, out var flags) >= 0) | |
{ | |
identifier.GetPriority(out var priority); | |
Console.WriteLine(" index: " + index + " flags: " + flags + " priority: " + priority + " icon:" + sb); | |
Console.WriteLine(); | |
} | |
} | |
} | |
} | |
} | |
[ComImport, Guid("0c6c4200-c589-11d0-999a-00c04fd655e1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | |
private interface IShellIconOverlayIdentifier | |
{ | |
[PreserveSig] | |
int IsMemberOf(string pwszPath, int dwAttrib); | |
[PreserveSig] | |
int GetOverlayInfo(StringBuilder pwszIconFile, int cchMax, out int pIndex, out ISIOI pdwFlags); | |
[PreserveSig] | |
int GetPriority(out int pPriority); | |
} | |
[Flags] | |
private enum ISIOI | |
{ | |
ISIOI_NONE = 0, | |
ISIOI_ICONFILE = 1, | |
ISIOI_ICONINDEX = 2, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment