private void viewInterfaceToolStripMenuItem_Click(object sender, EventArgs e) { try { COMObjRefStandard objref = COMUtilities.MarshalObjectToObjRef(m_pObject, GetSelectedIID(), MSHCTX.DIFFERENTMACHINE, MSHLFLAGS.NORMAL) as COMObjRefStandard; if (objref == null) { throw new Exception("Object must be standard marshaled to view the interface"); } EntryPoint.GetMainForm(m_registry).LoadIPid(objref.Ipid); } catch (Exception ex) { EntryPoint.ShowError(this, ex); } }
public StandardMarshalEditorControl(COMRegistry registry, COMObjRefStandard objref) { m_objref = objref; m_registry = registry; InitializeComponent(); textBoxStandardFlags.Text = String.Format("0x{0:X}", objref.StdFlags); textBoxPublicRefs.Text = objref.PublicRefs.ToString(); textBoxOxid.Text = String.Format("0x{0:X016}", objref.Oxid); textBoxOid.Text = String.Format("0x{0:X016}", objref.Oid); textBoxIpid.Text = objref.Ipid.FormatGuid(); textBoxApartmentId.Text = COMUtilities.GetApartmentIdStringFromIPid(objref.Ipid); int pid = COMUtilities.GetProcessIdFromIPid(objref.Ipid); textBoxProcessId.Text = COMUtilities.GetProcessIdFromIPid(objref.Ipid).ToString(); try { Process p = Process.GetProcessById(pid); textBoxProcessName.Text = p.ProcessName; } catch (ArgumentException) { textBoxProcessName.Text = "N/A"; } COMObjRefHandler handler = objref as COMObjRefHandler; if (handler != null) { textBoxHandlerClsid.Text = handler.Clsid.FormatGuid(); COMCLSIDEntry ent = registry.MapClsidToEntry(handler.Clsid); if (ent != null) { textBoxHandlerName.Text = ent.Name; } } else { tableLayoutPanel.Controls.Remove(lblHandlerClsid); tableLayoutPanel.Controls.Remove(lblHandlerName); tableLayoutPanel.Controls.Remove(textBoxHandlerClsid); tableLayoutPanel.Controls.Remove(textBoxHandlerName); } foreach (COMStringBinding str in objref.StringBindings) { ListViewItem item = listViewStringBindings.Items.Add(str.TowerId.ToString()); item.SubItems.Add(str.NetworkAddr); item.Tag = str; } listViewStringBindings.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); listViewStringBindings.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); foreach (COMSecurityBinding sec in objref.SecurityBindings) { ListViewItem item = listViewSecurityBindings.Items.Add(sec.AuthnSvc.ToString()); item.SubItems.Add(sec.PrincName); item.Tag = sec; } listViewSecurityBindings.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); listViewSecurityBindings.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); }