Skip to content

Instantly share code, notes, and snippets.

@jiulongw
Last active August 29, 2015 14:06
Show Gist options
  • Save jiulongw/beb39e2eae4cebce1279 to your computer and use it in GitHub Desktop.
Save jiulongw/beb39e2eae4cebce1279 to your computer and use it in GitHub Desktop.
COM interface finder
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
{
try
{
foreach (Type t in a.GetExportedTypes())
{
try
{
IntPtr pUnk = Marshal.GetIUnknownForObject(ProjectCfgObject);
Guid iid = t.GUID;
IntPtr ppv;
Marshal.QueryInterface(pUnk, ref iid, out ppv);
if(ppv != IntPtr.Zero)
{
System.Diagnostics.Debug.WriteLine(t.FullName);
}
}
catch { }
}
}
catch { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment