private string BuildInterfaceToolTip(COMInterfaceEntry ent, COMInterfaceInstance instance)
        {            
            StringBuilder builder = new StringBuilder();

            AppendFormatLine(builder, "Name: {0}", ent.Name);
            AppendFormatLine(builder, "IID: {0}", ent.Iid.ToString("B"));
            if (ent.ProxyClsid != Guid.Empty)
            {
                AppendFormatLine(builder, "ProxyCLSID: {0}", ent.ProxyClsid.ToString("B"));
            }
            if (instance != null && instance.ModulePath != null)
            {
                AppendFormatLine(builder, "VTable Address: {0}+0x{1:X}", instance.ModulePath, instance.VTableOffset);
            }

            return builder.ToString();
        }
        private TreeNode CreateInterfaceNameNode(COMInterfaceEntry ent, COMInterfaceInstance instance)
        {
            TreeNode nodeRet = new TreeNode(ent.Name, InterfaceIcon, InterfaceIcon);
            nodeRet.ToolTipText = BuildInterfaceToolTip(ent, instance);
            nodeRet.Tag = ent;

            return nodeRet;
        }
        private void QueryInterface(IntPtr punk, Guid iid, Dictionary<IntPtr, string> module_names, List<COMInterfaceInstance> list)
        {
            if (punk != IntPtr.Zero)
            {
                IntPtr ppout;
                if (Marshal.QueryInterface(punk, ref iid, out ppout) == 0)
                {
                    IntPtr vtable = Marshal.ReadIntPtr(ppout, 0);
                    IntPtr module;
                    COMInterfaceInstance intf;

                    if (_clsctx == CLSCTX.CLSCTX_INPROC_SERVER && GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, vtable, out module))
                    {
                        if (!module_names.ContainsKey(module))
                        {
                            module_names[module] = GetModuleFileName(module);
                        }
                        intf = new COMInterfaceInstance(iid, module_names[module], vtable.ToInt64() - module.ToInt64());
                    }
                    else
                    {
                        intf = new COMInterfaceInstance(iid);
                    }


                    list.Add(intf);
                    Marshal.Release(ppout);
                }
            }
        }