MapIidToInterface() публичный Метод

Map an IID to an interface object.
public MapIidToInterface ( System.Guid iid ) : COMInterfaceEntry
iid System.Guid The interface to map.
Результат COMInterfaceEntry
Пример #1
0
        public async Task HostObject(ICOMClassEntry ent, object obj, bool factory)
        {
            Dictionary <string, string> props = new Dictionary <string, string>();

            if (ent == null)
            {
                ent = new COMCLSIDEntry(m_registry, Guid.Empty, COMServerType.UnknownServer);
            }
            props.Add("CLSID", ent.Clsid.FormatGuid());
            props.Add("Name", ent.Name);
            props.Add("Server", ent.DefaultServer);

            /* Need to implement a type library reader */
            Type dispType = COMUtilities.GetDispatchTypeInfo(this, obj);

            if (!ent.InterfacesLoaded)
            {
                await ent.LoadSupportedInterfacesAsync(false, null);
            }

            IEnumerable <COMInterfaceInstance> intfs = factory ? ent.FactoryInterfaces : ent.Interfaces;

            ObjectInformation view = new ObjectInformation(m_registry, ent, ent.Name, obj,
                                                           props, intfs.Select(i => m_registry.MapIidToInterface(i.Iid)).ToArray());

            HostControl(view);
        }
Пример #2
0
        private async void OpenObjectInformation(object comObj, string defaultName)
        {
            if (comObj != null)
            {
                Dictionary <string, string> props = new Dictionary <string, string>();
                string strObjName = "";
                IEnumerable <COMInterfaceEntry> ints = null;
                Guid clsid = COMUtilities.GetObjectClass(comObj);

                if (m_registry.Clsids.ContainsKey(clsid))
                {
                    COMCLSIDEntry ent = m_registry.Clsids[clsid];
                    strObjName = ent.Name;
                    props.Add("CLSID", ent.Clsid.ToString("B"));
                    props.Add("Name", ent.Name);
                    props.Add("Server", ent.Server);
                    await ent.LoadSupportedInterfacesAsync(false);

                    ints = ent.Interfaces.Select(i => m_registry.MapIidToInterface(i.Iid));
                }
                else
                {
                    ints       = m_registry.GetInterfacesForObject(comObj);
                    strObjName = defaultName != null ? defaultName : clsid.ToString("B");
                    props.Add("CLSID", clsid.ToString("B"));
                }

                Type dispType = COMUtilities.GetDispatchTypeInfo(comObj);
                HostControl(new ObjectInformation(m_registry, strObjName, comObj, props, ints.ToArray()));
            }
        }
        public MarshalEditorControl(COMRegistry registry, COMObjRef objref)
        {
            m_objref   = objref;
            m_registry = registry;
            InitializeComponent();
            textBoxObjRefType.Text = objref.Flags.ToString();
            textBoxIid.Text        = objref.Iid.FormatGuid();
            textBoxIIdName.Text    = registry.MapIidToInterface(objref.Iid).Name;
            Control ctl = null;

            if (objref is COMObjRefStandard)
            {
                ctl = new StandardMarshalEditorControl(registry, (COMObjRefStandard)objref);
            }
            else if (objref is COMObjRefCustom)
            {
                ctl = new CustomMarshalEditorControl(registry, (COMObjRefCustom)objref);
            }

            if (ctl != null)
            {
                tableLayoutPanel.Controls.Add(ctl, 0, 1);
                tableLayoutPanel.SetColumnSpan(ctl, tableLayoutPanel.ColumnCount);
                ctl.Dock = DockStyle.Fill;
            }

            Text = string.Format("Marshal Viewer - {0}", objref.Flags);
        }
Пример #4
0
 private void LoadInterfaceList(IEnumerable <COMInterfaceInstance> entries, ListView view)
 {
     view.Items.Clear();
     foreach (Tuple <COMInterfaceInstance, COMInterfaceEntry> entry in
              entries.Select(e => new Tuple <COMInterfaceInstance, COMInterfaceEntry>(e, m_registry.MapIidToInterface(e.Iid))).OrderBy(e => e.Item2.Name))
     {
         ListViewItem item = view.Items.Add(entry.Item2.Name);
         item.SubItems.Add(entry.Item1.Iid.FormatGuid());
         item.SubItems.Add(entry.Item2.NumMethods.ToString());
         if (!string.IsNullOrWhiteSpace(entry.Item1.Module))
         {
             item.SubItems.Add(string.Format("{0}+0x{1:X}",
                                             entry.Item1.Module, entry.Item1.VTableOffset));
         }
         item.Tag = entry;
     }
     view.ListViewItemSorter = new ListItemComparer(0);
     view.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     view.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
 }
Пример #5
0
 private void LoadInterfaceList(IEnumerable <COMInterfaceInstance> entries, ListView view)
 {
     view.Items.Clear();
     foreach (COMInterfaceInstance entry in entries)
     {
         COMInterfaceEntry int_entry = _registry.MapIidToInterface(entry.Iid);
         ListViewItem      item      = view.Items.Add(int_entry.Name);
         item.SubItems.Add(int_entry.NumMethods.ToString());
         if (!String.IsNullOrWhiteSpace(entry.ModulePath))
         {
             item.SubItems.Add(String.Format("{0}+0x{1:X}", entry.ModulePath, entry.VTableOffset));
         }
         item.Tag = entry;
     }
     view.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     view.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
 }
Пример #6
0
        private async Task SetupCLSIDNodeTree(TreeNode node, bool bRefresh)
        {
            COMCLSIDEntry clsid = null;

            if (node.Tag is COMCLSIDEntry)
            {
                clsid = (COMCLSIDEntry)node.Tag;
            }
            else if (node.Tag is COMProgIDEntry)
            {
                clsid = m_reg.MapClsidToEntry(((COMProgIDEntry)node.Tag).Clsid);
            }

            if (clsid != null)
            {
                node.Nodes.Clear();
                TreeNode wait_node = new TreeNode("Please Wait, Populating Interfaces", InterfaceIcon, InterfaceIcon);
                node.Nodes.Add(wait_node);
                try
                {
                    await clsid.LoadSupportedInterfacesAsync(bRefresh);

                    if (clsid.Interfaces.Count() > 0)
                    {
                        node.Nodes.Remove(wait_node);
                        foreach (COMInterfaceInstance ent in clsid.Interfaces)
                        {
                            node.Nodes.Add(CreateInterfaceNameNode(m_reg.MapIidToInterface(ent.Iid), ent));
                        }
                    }
                    else
                    {
                        wait_node.Text = "Error querying COM interfaces - Timeout";
                    }
                }
                catch (Win32Exception ex)
                {
                    wait_node.Text = String.Format("Error querying COM interfaces - {0}", ex.Message);
                }
            }
        }