public static GetMainForm ( ) : |
||
Результат |
private void btnMarshalProps_Click(object sender, EventArgs e) { try { COMObjRef objref = COMObjRef.FromArray(hexEditor.Bytes); Program.GetMainForm(m_registry).HostControl(new MarshalEditorControl(m_registry, objref)); } catch (Exception ex) { Program.ShowError(this, ex); } }
private void btnOpenTypeLib_Click(object sender, EventArgs e) { if (m_typelib != null) { Assembly typelib = COMUtilities.LoadTypeLib(this, m_typelib.NativePath); if (typelib != null) { Program.GetMainForm(m_registry).HostControl(new TypeLibControl(m_typelib.Name, typelib, m_interface != null ? m_interface.Iid : Guid.Empty, false)); } } }
private void btnDispatch_Click(object sender, EventArgs e) { Type disp_type = COMUtilities.GetDispatchTypeInfo(this, m_pObject); if (disp_type != null) { Control frm = new TypedObjectViewer(m_registry, m_objName, m_pEntry, disp_type); if ((frm != null) && !frm.IsDisposed) { Program.GetMainForm(m_registry).HostControl(frm); } } }
private void btnMarshal_Click(object sender, EventArgs e) { try { Program.GetMainForm(m_registry).HostControl(new ObjectHexEditor(m_registry, "Marshal Editor", COMUtilities.MarshalObject(m_pObject, GetSelectedIID(), MSHCTX.DIFFERENTMACHINE, MSHLFLAGS.NORMAL))); } catch (Exception ex) { Program.ShowError(this, ex); } }
private async void btnUnmarshal_Click(object sender, EventArgs e) { try { MemoryStream stm = new MemoryStream(hexEditor.Bytes); object obj = COMUtilities.UnmarshalObject(hexEditor.Bytes); await Program.GetMainForm(m_registry).OpenObjectInformation(obj, "Unmarshaled Object"); } catch (Exception ex) { Program.ShowError(this, ex); } }
private void viewPropertiesToolStripMenuItem_Click(object sender, EventArgs e) { try { Program.GetMainForm(m_registry).HostControl(new MarshalEditorControl(m_registry, COMUtilities.MarshalObjectToObjRef(m_pObject, GetSelectedIID(), MSHCTX.DIFFERENTMACHINE, MSHLFLAGS.NORMAL))); } catch (Exception ex) { Program.ShowError(this, ex); } }
private async void btnLoadFromStream_Click(object sender, System.EventArgs e) { try { MemoryStream stm = new MemoryStream(hexEditor.Bytes); Guid clsid; object obj = COMUtilities.OleLoadFromStream(new MemoryStream(hexEditor.Bytes), out clsid); await Program.GetMainForm(m_registry).HostObject(m_registry.MapClsidToEntry(clsid), obj, false); } catch (Exception ex) { Program.ShowError(this, ex); } }
private async void btnCreate_Click(object sender, EventArgs e) { try { object comObj = m_clsid.CreateInstanceAsObject(m_clsid.CreateContext, null); if (comObj != null) { await Program.GetMainForm(m_registry).HostObject(m_clsid, comObj, false); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSaveStream_Click(object sender, EventArgs e) { try { using (MemoryStream stm = new MemoryStream()) { COMUtilities.OleSaveToStream(m_pObject, stm); Program.GetMainForm(m_registry).HostControl(new ObjectHexEditor(m_registry, "Stream Editor", stm.ToArray())); } } catch (Exception ex) { Program.ShowError(this, ex); } }
private void listViewElevationVSOs_DoubleClick(object sender, EventArgs e) { if (listViewElevationVSOs.SelectedItems.Count < 1) { return; } COMCLSIDEntry clsid = listViewElevationVSOs.SelectedItems[0].Tag as COMCLSIDEntry; if (clsid != null) { Program.GetMainForm(m_registry).HostControl(new PropertiesControl(m_registry, clsid.Name, clsid)); } }
public static void ViewSecurity(COMRegistry registry, string name, string sddl, bool access) { if (!String.IsNullOrWhiteSpace(sddl)) { SecurityDescriptor sd = new SecurityDescriptor(sddl); AccessMask valid_access = access ? 0x7 : 0x1F; SecurityDescriptorViewerControl control = new SecurityDescriptorViewerControl(); Program.GetMainForm(registry).HostControl(control, name); control.SetSecurityDescriptor(sd, typeof(COMAccessRights), new GenericMapping() { GenericExecute = valid_access, GenericRead = valid_access, GenericWrite = valid_access, GenericAll = valid_access }, valid_access); } }
private async void createInstanceToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = treeComRegistry.SelectedNode; if (node != null) { COMCLSIDEntry ent = null; if (node.Tag is COMCLSIDEntry) { ent = (COMCLSIDEntry)node.Tag; } else if (node.Tag is COMProgIDEntry) { ent = m_reg.MapClsidToEntry(((COMProgIDEntry)node.Tag).Clsid); } if (ent != null) { Dictionary <string, string> props = new Dictionary <string, string>(); try { object comObj = ent.CreateInstanceAsObject(CLSCTX.CLSCTX_ALL); if (comObj != null) { props.Add("CLSID", ent.Clsid.ToString("B")); props.Add("Name", ent.Name); props.Add("Server", ent.Server); /* Need to implement a type library reader */ Type dispType = COMUtilities.GetDispatchTypeInfo(comObj); await ent.LoadSupportedInterfacesAsync(false); ObjectInformation view = new ObjectInformation(m_reg, ent.Name, comObj, props, ent.Interfaces.Select(i => m_reg.MapIidToInterface(i.Iid)).ToArray()); Program.GetMainForm().HostControl(view); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private async void toObjectToolStripMenuItem_Click(object sender, EventArgs e) { COMIPIDEntry ipid = GetSelectedIpid(); if (ipid != null) { try { await Program.GetMainForm(m_registry).OpenObjectInformation( COMUtilities.UnmarshalObject(ipid.ToObjref()), String.Format("IPID {0}", ipid.Ipid)); } catch (Exception ex) { Program.ShowError(this, ex); } } }
private void btnCreate_Click(object sender, EventArgs e) { try { IClassFactory factory = (IClassFactory)m_pObject; object new_object; Guid IID_IUnknown = COMInterfaceEntry.IID_IUnknown; Dictionary <string, string> props = new Dictionary <string, string>(); props.Add("Name", m_objName); factory.CreateInstance(null, ref IID_IUnknown, out new_object); ObjectInformation view = new ObjectInformation(m_registry, m_objName, new_object, props, m_registry.GetInterfacesForObject(new_object)); Program.GetMainForm().HostControl(view); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void listViewIpidMethods_DoubleClick(object sender, EventArgs e) { bool has_ndr = false; foreach (var method in m_ipid.Methods) { if (method.Procedure != null) { has_ndr = true; break; } } if (has_ndr) { string name = m_registry.MapIidToInterface(m_ipid.Iid).Name; Program.GetMainForm(m_registry).HostControl(new TypeLibControl(m_registry, name, m_ipid.ToProxyInstance(name), m_ipid.Iid)); } }
private void viewTypeLibraryToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = treeComRegistry.SelectedNode; if (node != null) { COMTypeLibVersionEntry ent = node.Tag as COMTypeLibVersionEntry; if (ent == null) { COMCLSIDEntry clsid = node.Tag as COMCLSIDEntry; COMProgIDEntry progid = node.Tag as COMProgIDEntry; if (progid != null) { clsid = m_reg.MapClsidToEntry(progid.Clsid); } if (clsid != null && m_reg.Typelibs.ContainsKey(clsid.TypeLib)) { ent = m_reg.Typelibs[clsid.TypeLib].Versions.First(); } } if (ent != null) { try { Assembly typeLibary = COMUtilities.LoadTypeLib(ent.NativePath); TypeLibControl view = new TypeLibControl(ent, typeLibary); Program.GetMainForm().HostControl(view); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void btnViewAssembly_Click(object sender, EventArgs e) { try { Assembly asm = null; if (!string.IsNullOrWhiteSpace(textBoxDotNetCodeBase.Text)) { asm = Assembly.LoadFrom(textBoxDotNetCodeBase.Text); } else { asm = Assembly.Load(textBoxDotNetAssemblyName.Text); } Program.GetMainForm(m_registry).HostControl(new TypeLibControl(asm.GetName().Name, asm, m_clsid != null ? m_clsid.Clsid : Guid.Empty, true)); } catch (Exception ex) { Program.ShowError(this, ex); } }
private void viewProxyDefinitionToolStripMenuItem_Click(object sender, EventArgs e) { try { ListView view = GetListViewForMenu(sender); if (view != null && view.SelectedIndices.Count > 0) { ListViewItem item = view.SelectedItems[0]; Tuple <COMInterfaceInstance, COMInterfaceEntry> intf = item.Tag as Tuple <COMInterfaceInstance, COMInterfaceEntry>; if (m_registry.Clsids.ContainsKey(intf.Item2.ProxyClsid)) { COMCLSIDEntry clsid = m_registry.Clsids[intf.Item2.ProxyClsid]; Program.GetMainForm(m_registry).HostControl(new TypeLibControl(m_registry, Path.GetFileName(clsid.DefaultServer), COMProxyInstance.GetFromCLSID(clsid), intf.Item1.Iid)); } } } catch (Exception ex) { Program.ShowError(this, ex); } }
private void listViewInterfaces_DoubleClick(object sender, EventArgs e) { if (listViewInterfaces.SelectedItems.Count > 0) { COMInterfaceEntry ent = (COMInterfaceEntry)listViewInterfaces.SelectedItems[0].Tag; InterfaceViewers.ITypeViewerFactory factory = InterfaceViewers.InterfaceViewers.GetInterfaceViewer(ent.Iid); try { if (factory != null) { Control frm = factory.CreateInstance(m_registry, m_objName, m_pEntry); if ((frm != null) && !frm.IsDisposed) { Program.GetMainForm().HostControl(frm); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnCreate_Click(object sender, EventArgs e) { try { IElevatedFactoryServer factory = (IElevatedFactoryServer)_obj; COMCLSIDEntry vso = comboBoxClass.SelectedItem as COMCLSIDEntry; if (vso != null) { object new_object; Dictionary <string, string> props = new Dictionary <string, string>(); props.Add("Name", _name); props.Add("CLSID", vso.Clsid.FormatGuid()); factory.ServerCreateElevatedObject(vso.Clsid, COMInterfaceEntry.IID_IUnknown, out new_object); ObjectInformation view = new ObjectInformation(_registry, vso, vso.Name, new_object, props, _registry.GetInterfacesForObject(new_object)); Program.GetMainForm(_registry).HostControl(view); } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnViewProcess_Click(object sender, EventArgs e) { Program.GetMainForm(m_registry).LoadIPid(m_objref.StdObjRef.Ipid); }
private void OpenObjectViewer(DynamicComObjectWrapper wrapper) { Program.GetMainForm(m_registry).HostControl(new TypedObjectViewer(m_registry, m_objName, wrapper.Instance, wrapper.InstanceType)); }