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); }
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); }
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); }