示例#1
0
        private void OpenObject(ListView lv)
        {
            if (lv.SelectedItems.Count > 0)
            {
                ListViewItem item = lv.SelectedItems[0];
                if (item.Tag is PropertyInfo)
                {
                    PropertyInfo pi  = (PropertyInfo)item.Tag;
                    object       val = null;

                    try
                    {
                        if (pi.CanRead)
                        {
                            val = pi.GetValue(m_pObject, null);
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.ToString());
                        val = null;
                    }

                    if (val != null)
                    {
                        EntryPoint.GetMainForm(m_registry).HostControl(new TypedObjectViewer(m_registry, m_objName, val, pi.PropertyType));
                    }
                }
            }
        }
示例#2
0
        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];
                        using (var resolver = EntryPoint.GetProxyParserSymbolResolver())
                        {
                            EntryPoint.GetMainForm(m_registry).HostControl(new TypeLibControl(m_registry,
                                                                                              Path.GetFileName(clsid.DefaultServer), COMProxyInstance.GetFromCLSID(clsid, resolver), intf.Item1.Iid));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                EntryPoint.ShowError(this, ex);
            }
        }
示例#3
0
        private void menuROTBindToObject_Click(object sender, EventArgs e)
        {
            if (listViewROT.SelectedItems.Count != 0)
            {
                MonikerInfo info = (MonikerInfo)(listViewROT.SelectedItems[0].Tag);

                Dictionary <string, string> props = new Dictionary <string, string>();
                props.Add("Display Name", info.strDisplayName);
                props.Add("CLSID", info.clsid.FormatGuid());

                try
                {
                    IBindCtx bindCtx = COMUtilities.CreateBindCtx(0);
                    Guid     unk     = COMInterfaceEntry.IID_IUnknown;
                    object   comObj;
                    Type     dispType;

                    info.moniker.BindToObject(bindCtx, null, ref unk, out comObj);
                    dispType = COMUtilities.GetDispatchTypeInfo(this, comObj);
                    ObjectInformation view = new ObjectInformation(m_registry, null, info.strDisplayName,
                                                                   comObj, props, m_registry.GetInterfacesForObject(comObj).ToArray());
                    EntryPoint.GetMainForm(m_registry).HostControl(view);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#4
0
 private void btnTreatAsProps_Click(object sender, EventArgs e)
 {
     if (m_registry.Clsids.ContainsKey(m_clsid.TreatAs))
     {
         EntryPoint.GetMainForm(m_registry).HostControl(new PropertiesControl(m_registry,
                                                                              m_clsid.Name, m_registry.Clsids[m_clsid.TreatAs]));
     }
 }
示例#5
0
 private void btnProxyProperties_Click(object sender, EventArgs e)
 {
     if (m_registry.Clsids.ContainsKey(m_interface.ProxyClsid))
     {
         COMCLSIDEntry entry = m_registry.Clsids[m_interface.ProxyClsid];
         EntryPoint.GetMainForm(m_registry).HostControl(new PropertiesControl(m_registry,
                                                                              entry.Name, entry));
     }
 }
示例#6
0
        private void toHexEditorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            COMIPIDEntry ipid = GetSelectedIpid();

            if (ipid != null)
            {
                EntryPoint.GetMainForm(m_registry).HostControl(new ObjectHexEditor(m_registry, ipid.Ipid.ToString(), ipid.ToObjref()));
            }
        }
示例#7
0
        private void listView_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListView list_view = sender as ListView;

            if (list_view != null && list_view.SelectedItems.Count > 0 && list_view.SelectedItems[0].Tag != null)
            {
                EntryPoint.GetMainForm(m_registry).UpdatePropertyGrid(list_view.SelectedItems[0].Tag);
            }
        }
        private void btnOleContainer_Click(object sender, EventArgs e)
        {
            Control frm = new ObjectContainer(m_objName, m_pObject);

            if ((frm != null) && !frm.IsDisposed)
            {
                EntryPoint.GetMainForm(m_registry).HostControl(frm);
            }
        }
示例#9
0
 private void btnOpenObject_Click(object sender, EventArgs e)
 {
     if (m_ret != null)
     {
         EntryPoint.GetMainForm(m_registry).HostControl(new TypedObjectViewer(m_registry, m_objName, m_ret, m_mi.ReturnType));
         DialogResult = DialogResult.OK;
         Close();
     }
 }
示例#10
0
        private async Task CreateInstance(bool class_factory)
        {
            COMProcessClassRegistration c = GetRegisteredClass();

            if (c != null)
            {
                await EntryPoint.GetMainForm(m_registry).CreateInstanceFromCLSID(c.Clsid, CLSCTX.LOCAL_SERVER, class_factory);
            }
        }
示例#11
0
        private void listViewProcessIPids_DoubleClick(object sender, EventArgs e)
        {
            COMIPIDEntry ipid = GetSelectedIpid();

            if (ipid != null)
            {
                EntryPoint.GetMainForm(m_registry).HostControl(new PropertiesControl(m_registry,
                                                                                     string.Format("IPID: {0}", COMUtilities.FormatGuid(ipid.Ipid)), ipid));
            }
        }
示例#12
0
        private void propertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            COMProcessClassRegistration c = GetRegisteredClass();

            if (c != null && m_registry.Clsids.ContainsKey(c.Clsid))
            {
                COMCLSIDEntry clsid = m_registry.MapClsidToEntry(c.Clsid);
                EntryPoint.GetMainForm(m_registry).HostControl(new PropertiesControl(m_registry, clsid.Name, clsid));
            }
        }
示例#13
0
 private void btnMarshalProps_Click(object sender, EventArgs e)
 {
     try
     {
         COMObjRef objref = COMObjRef.FromArray(hexEditor.Bytes);
         EntryPoint.GetMainForm(m_registry).HostControl(new MarshalEditorControl(m_registry, objref));
     }
     catch (Exception ex)
     {
         EntryPoint.ShowError(this, ex);
     }
 }
示例#14
0
 private void btnOpenTypeLib_Click(object sender, EventArgs e)
 {
     if (m_typelib != null)
     {
         Assembly typelib = COMUtilities.LoadTypeLib(this, m_typelib.NativePath);
         if (typelib != null)
         {
             EntryPoint.GetMainForm(m_registry).HostControl(new TypeLibControl(m_typelib.Name,
                                                                               typelib, m_interface != null ? m_interface.Iid : Guid.Empty, false));
         }
     }
 }
 private void viewPropertiesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         EntryPoint.GetMainForm(m_registry).HostControl(new MarshalEditorControl(m_registry,
                                                                                 COMUtilities.MarshalObjectToObjRef(m_pObject, GetSelectedIID(),
                                                                                                                    MSHCTX.DIFFERENTMACHINE, MSHLFLAGS.NORMAL)));
     }
     catch (Exception ex)
     {
         EntryPoint.ShowError(this, ex);
     }
 }
示例#16
0
 private async void btnUnmarshal_Click(object sender, EventArgs e)
 {
     try
     {
         MemoryStream stm = new MemoryStream(hexEditor.Bytes);
         object       obj = COMUtilities.UnmarshalObject(hexEditor.Bytes);
         await EntryPoint.GetMainForm(m_registry).OpenObjectInformation(obj, "Unmarshaled Object");
     }
     catch (Exception ex)
     {
         EntryPoint.ShowError(this, ex);
     }
 }
        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)
                {
                    EntryPoint.GetMainForm(m_registry).HostControl(frm);
                }
            }
        }
 private void btnMarshal_Click(object sender, EventArgs e)
 {
     try
     {
         EntryPoint.GetMainForm(m_registry).HostControl(new ObjectHexEditor(m_registry,
                                                                            "Marshal Editor", COMUtilities.MarshalObject(m_pObject, GetSelectedIID(),
                                                                                                                         MSHCTX.DIFFERENTMACHINE, MSHLFLAGS.NORMAL)));
     }
     catch (Exception ex)
     {
         EntryPoint.ShowError(this, ex);
     }
 }
示例#19
0
 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 EntryPoint.GetMainForm(m_registry).HostObject(m_registry.MapClsidToEntry(clsid), obj, false);
     }
     catch (Exception ex)
     {
         EntryPoint.ShowError(this, ex);
     }
 }
 private void btnSaveStream_Click(object sender, EventArgs e)
 {
     try
     {
         using (MemoryStream stm = new MemoryStream())
         {
             COMUtilities.OleSaveToStream(m_pObject, stm);
             EntryPoint.GetMainForm(m_registry).HostControl(new ObjectHexEditor(m_registry, "Stream Editor", stm.ToArray()));
         }
     }
     catch (Exception ex)
     {
         EntryPoint.ShowError(this, ex);
     }
 }
示例#21
0
        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)
            {
                EntryPoint.GetMainForm(m_registry).HostControl(new PropertiesControl(m_registry,
                                                                                     clsid.Name, clsid));
            }
        }
示例#22
0
 private async void btnCreate_Click(object sender, EventArgs e)
 {
     try
     {
         object comObj = m_clsid.CreateInstanceAsObject(m_clsid.CreateContext, null);
         if (comObj != null)
         {
             await EntryPoint.GetMainForm(m_registry).HostObject(m_clsid, comObj, false);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#23
0
        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();
                EntryPoint.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);
            }
        }
示例#24
0
        private async void toObjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            COMIPIDEntry ipid = GetSelectedIpid();

            if (ipid != null)
            {
                try
                {
                    await EntryPoint.GetMainForm(m_registry).OpenObjectInformation(
                        COMUtilities.UnmarshalObject(ipid.ToObjref()),
                        String.Format("IPID {0}", ipid.Ipid));
                }
                catch (Exception ex)
                {
                    EntryPoint.ShowError(this, ex);
                }
            }
        }
        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);
            }
        }
示例#26
0
 private void btnCreateInstance_Click(object sender, EventArgs e)
 {
     try
     {
         IClassFactory factory = (IClassFactory)_obj;
         object        new_object;
         Guid          IID_IUnknown        = COMInterfaceEntry.IID_IUnknown;
         Dictionary <string, string> props = new Dictionary <string, string>();
         props.Add("Name", _name);
         factory.CreateInstance(null, ref IID_IUnknown, out new_object);
         ObjectInformation view = new ObjectInformation(_registry, _entry, _name, new_object,
                                                        props, _registry.GetInterfacesForObject(new_object));
         EntryPoint.GetMainForm(_registry).HostControl(view);
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#27
0
        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;
                EntryPoint.GetMainForm(m_registry).HostControl(new TypeLibControl(m_registry, name, m_ipid.ToProxyInstance(), m_ipid.Iid));
            }
        }
示例#28
0
        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);
                }

                EntryPoint.GetMainForm(m_registry).HostControl(new TypeLibControl(asm.GetName().Name,
                                                                                  asm, m_clsid != null ? m_clsid.Clsid : Guid.Empty, true));
            }
            catch (Exception ex)
            {
                EntryPoint.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_entry, m_objName, m_pEntry);
                        if ((frm != null) && !frm.IsDisposed)
                        {
                            EntryPoint.GetMainForm(m_registry).HostControl(frm);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#30
0
 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));
             EntryPoint.GetMainForm(_registry).HostControl(view);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }