Example #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);
        }
        /// <summary>
        /// Build a tooltip for a CLSID entry
        /// </summary>
        /// <param name="ent">The CLSID entry to build the tool tip from</param>
        /// <returns>A string tooltip</returns>
        private static string BuildCLSIDToolTip(COMCLSIDEntry ent)
        {
            StringBuilder strRet = new StringBuilder();

            AppendFormatLine(strRet, "CLSID: {0}", ent.Clsid.ToString("B"));
            AppendFormatLine(strRet, "Name: {0}", ent.Name);
            AppendFormatLine(strRet, "{0}: {1}", ent.ServerType.ToString(), ent.Server);
            IEnumerable <string> progids = ent.ProgIDs;

            if (progids.Count() > 0)
            {
                strRet.AppendLine("ProgIDs:");
                foreach (string progid in progids)
                {
                    AppendFormatLine(strRet, "{0}", progid);
                }
            }
            if (ent.AppID != Guid.Empty)
            {
                AppendFormatLine(strRet, "AppID: {0}", ent.AppID.ToString("B"));
            }
            if (ent.TypeLib != Guid.Empty)
            {
                AppendFormatLine(strRet, "TypeLib: {0}", ent.TypeLib.ToString("B"));
            }

            IEnumerable <COMInterfaceEntry> proxies = ent.Proxies;

            if (proxies.Count() > 0)
            {
                AppendFormatLine(strRet, "Interface Proxies: {0}", proxies.Count());
            }

            return(strRet.ToString());
        }
Example #3
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()));
            }
        }
Example #4
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);
            }
        }
 private COMProxyInstance(COMCLSIDEntry clsid)
 {
     if (!InitFromFile(clsid.DefaultServer, clsid.Clsid))
     {
         throw new ArgumentException("Can't find proxy information in server DLL");
     }
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="objName">Descriptive name of the object</param>
        /// <param name="pObject">Managed wrapper to the object</param>
        /// <param name="properties">List of textual properties to display</param>
        /// <param name="interfaces">List of available interfaces</param>
        public ObjectInformation(COMRegistry registry, COMCLSIDEntry entry, string objName, Object pObject, Dictionary <string, string> properties, COMInterfaceEntry[] interfaces)
        {
            m_entry = entry;
            if (m_entry == null)
            {
                Guid clsid = COMUtilities.GetObjectClass(pObject);
                if (registry.Clsids.ContainsKey(clsid))
                {
                    m_entry = registry.MapClsidToEntry(clsid);
                }
            }

            m_registry   = registry;
            m_pEntry     = ObjectCache.Add(registry, objName, pObject, interfaces);
            m_pObject    = pObject;
            m_properties = properties;
            m_interfaces = interfaces;
            m_objName    = objName;

            InitializeComponent();

            LoadProperties();
            LoadInterfaces();
            Text = m_objName;
            listViewInterfaces.ListViewItemSorter = new ListItemComparer(0);
        }
 public ClassFactoryTypeViewer(COMRegistry registry, COMCLSIDEntry entry, string objName, object obj)
 {
     InitializeComponent();
     _obj      = obj;
     _name     = objName;
     _registry = registry;
     _entry    = entry;
     Text      = objName + " ClassFactory";
 }
Example #8
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));
     }
 }
Example #9
0
        private async void menuViewCreateInstanceFromCLSID_Click(object sender, EventArgs e)
        {
            using (CreateCLSIDForm frm = new CreateCLSIDForm())
            {
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        Guid g = frm.Clsid;
                        Dictionary <string, string> props = new Dictionary <string, string>();
                        object comObj     = null;
                        string strObjName = "";
                        IEnumerable <COMInterfaceEntry> ints = null;

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

                            comObj = ent.CreateInstanceAsObject(frm.ClsCtx);
                            await ent.LoadSupportedInterfacesAsync(false);
                        }
                        else
                        {
                            Guid   unk = COMInterfaceEntry.IID_IUnknown;
                            IntPtr pObj;

                            if (COMUtilities.CoCreateInstance(ref g, IntPtr.Zero, frm.ClsCtx,
                                                              ref unk, out pObj) == 0)
                            {
                                ints       = m_registry.GetInterfacesForIUnknown(pObj);
                                comObj     = Marshal.GetObjectForIUnknown(pObj);
                                strObjName = g.ToString("B");
                                props.Add("CLSID", g.ToString("B"));
                                Marshal.Release(pObj);
                            }
                        }

                        if (comObj != null)
                        {
                            /* Need to implement a type library reader */
                            Type dispType = COMUtilities.GetDispatchTypeInfo(comObj);

                            HostControl(new ObjectInformation(m_registry, strObjName, comObj, props, ints.ToArray()));
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Example #10
0
        private COMProxyInterfaceInstance(COMCLSIDEntry clsid, ISymbolResolver resolver, COMInterfaceEntry intf, COMRegistry registry)
        {
            NdrParser parser = new NdrParser(resolver);

            Entry        = parser.ReadFromComProxyFile(clsid.DefaultServer, clsid.Clsid, new Guid[] { intf.Iid }).FirstOrDefault();
            ComplexTypes = parser.ComplexTypes;
            OriginalName = intf.Name;
            ClassEntry   = clsid;
            m_registry   = registry;
        }
        private static TreeNode CreateClsidNode(COMCLSIDEntry ent)
        {
            TreeNode currNode = new TreeNode(ent.Name, ClassIcon, ClassIcon);

            currNode.ToolTipText = BuildCLSIDToolTip(ent);
            currNode.Tag         = ent;
            currNode.Nodes.Add("IUnknown");

            return(currNode);
        }
        private TreeNode CreateCLSIDNode(COMCLSIDEntry ent)
        {
            TreeNode nodeRet = new TreeNode(String.Format("{0} - {1}", ent.Clsid.ToString(), ent.Name), ClassIcon, ClassIcon);

            nodeRet.ToolTipText = BuildCLSIDToolTip(ent);
            nodeRet.Tag         = ent;
            nodeRet.Nodes.Add("IUnknown");

            return(nodeRet);
        }
Example #13
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));
            }
        }
Example #14
0
 public COMInterfaceEntry[] GetProxiesForClsid(COMCLSIDEntry clsid)
 {
     if (ProxiesByClsid.ContainsKey(clsid.Clsid))
     {
         return(ProxiesByClsid[clsid.Clsid].ToArray());
     }
     else
     {
         return(new COMInterfaceEntry[0]);
     }
 }
Example #15
0
        /// <summary>
        /// Load CLSID information from the registry key
        /// </summary>
        /// <param name="rootKey">The root registry key, e.g. HKEY_CLASSES_ROOT</param>
        /// <param name="actctx">The system default activation context.</param>
        private void LoadCLSIDs(RegistryKey rootKey, ActivationContext actctx)
        {
            Dictionary <Guid, COMCLSIDEntry> clsids     = new Dictionary <Guid, COMCLSIDEntry>();
            Dictionary <Guid, List <Guid> >  categories = new Dictionary <Guid, List <Guid> >();

            if (actctx != null)
            {
                foreach (var com_server in actctx.ComServers)
                {
                    clsids[com_server.Clsid] = new COMCLSIDEntry(this, com_server);
                }
            }

            using (RegistryKey clsidKey = rootKey.OpenSubKey("CLSID"))
            {
                if (clsidKey != null)
                {
                    string[] subkeys = clsidKey.GetSubKeyNames();
                    foreach (string key in subkeys)
                    {
                        if (!Guid.TryParse(key, out Guid clsid))
                        {
                            continue;
                        }
                        if (clsids.ContainsKey(clsid))
                        {
                            continue;
                        }

                        using (RegistryKey regKey = clsidKey.OpenSubKey(key))
                        {
                            if (regKey != null)
                            {
                                COMCLSIDEntry ent = new COMCLSIDEntry(this, clsid, regKey);
                                clsids.Add(clsid, ent);
                                foreach (Guid catid in ent.Categories)
                                {
                                    if (!categories.ContainsKey(catid))
                                    {
                                        categories[catid] = new List <Guid>();
                                    }
                                    categories[catid].Add(ent.Clsid);
                                }
                            }
                        }
                    }
                }
            }

            m_clsids     = new SortedDictionary <Guid, COMCLSIDEntry>(clsids);
            m_categories = categories.ToSortedDictionary(p => p.Key, p => new COMCategory(this, p.Key, p.Value));
        }
 public static COMProxyInstance GetFromCLSID(COMCLSIDEntry clsid)
 {
     if (m_proxies.ContainsKey(clsid.Clsid))
     {
         return(m_proxies[clsid.Clsid]);
     }
     else
     {
         COMProxyInstance proxy = new COMProxyInstance(clsid);
         m_proxies[clsid.Clsid] = proxy;
         return(proxy);
     }
 }
Example #17
0
 public static COMProxyInstance GetFromCLSID(COMCLSIDEntry clsid, ISymbolResolver resolver)
 {
     if (m_proxies.ContainsKey(clsid.Clsid))
     {
         return(m_proxies[clsid.Clsid]);
     }
     else
     {
         COMProxyInstance proxy = new COMProxyInstance(clsid.DefaultServer, clsid.Clsid, resolver, clsid.Database);
         m_proxies[clsid.Clsid] = proxy;
         return(proxy);
     }
 }
Example #18
0
        private void SetupProperties(object obj)
        {
            if (obj is COMCLSIDEntry)
            {
                SetupClsidEntry((COMCLSIDEntry)obj);
            }

            if (obj is COMProgIDEntry)
            {
                COMProgIDEntry entry       = (COMProgIDEntry)obj;
                COMCLSIDEntry  clsid_entry = m_registry.MapClsidToEntry(entry.Clsid);
                SetupClsidEntry(clsid_entry);
            }

            if (obj is COMAppIDEntry)
            {
                SetupAppIdEntry((COMAppIDEntry)obj);
            }

            if (obj is COMInterfaceEntry)
            {
                SetupInterfaceEntry((COMInterfaceEntry)obj);
            }

            if (obj is COMTypeLibVersionEntry)
            {
                SetupTypeLibVersionEntry((COMTypeLibVersionEntry)obj);
            }

            if (obj is COMProcessEntry)
            {
                SetupProcessEntry((COMProcessEntry)obj);
            }

            if (obj is COMIPIDEntry)
            {
                SetupIPIDEntry((COMIPIDEntry)obj);
            }

            if (obj is COMRuntimeClassEntry)
            {
                SetupRuntimeClassEntry((COMRuntimeClassEntry)obj);
            }

            if (obj is COMRuntimeServerEntry)
            {
                SetupRuntimeServerEntry((COMRuntimeServerEntry)obj);
            }
        }
Example #19
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));
            }
        }
        private async void btnRefreshInterfaces_Click(object sender, EventArgs e)
        {
            try
            {
                COMCLSIDEntry entry = (COMCLSIDEntry)tabPageSupportedInterfaces.Tag;
                await entry.LoadSupportedInterfacesAsync(true);

                LoadInterfaceList(entry.Interfaces, listViewInterfaces);
                LoadInterfaceList(entry.FactoryInterfaces, listViewFactoryInterfaces);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public async static Task <COMEnumerateInterfaces> GetInterfacesOOP(COMCLSIDEntry ent)
        {
            string apartment = "s";

            if (ent.DefaultThreadingModel == COMThreadingModel.Both ||
                ent.DefaultThreadingModel == COMThreadingModel.Free)
            {
                apartment = "m";
            }

            string command_line = string.Format("{0} {1} \"{2}\"", ent.Clsid.ToString("B"), apartment, ent.CreateContext);
            var    interfaces   = await GetInterfacesOOP(command_line, false);

            return(new COMEnumerateInterfaces(ent.Clsid, ent.CreateContext, string.Empty, interfaces.Interfaces, interfaces.FactoryInterfaces));
        }
Example #22
0
        public CustomMarshalEditorControl(COMRegistry registry, COMObjRefCustom objref)
        {
            m_objref   = objref;
            m_registry = registry;
            InitializeComponent();
            textBoxClsid.Text = objref.Clsid.FormatGuid();
            COMCLSIDEntry ent = registry.MapClsidToEntry(objref.Clsid);

            if (ent != null)
            {
                textBoxName.Text = ent.Name;
            }

            hexEditor.Bytes = objref.ObjectData;
        }
        /// <summary>
        /// Build a ProgID entry tooltip
        /// </summary>
        /// <param name="ent">The ProgID entry</param>
        /// <returns>The ProgID tooltip</returns>
        private string BuildProgIDToolTip(COMProgIDEntry ent)
        {
            string        strRet;
            COMCLSIDEntry entry = m_reg.MapClsidToEntry(ent.Clsid);

            if (entry != null)
            {
                strRet = BuildCLSIDToolTip(entry);
            }
            else
            {
                strRet = String.Format("CLSID: {0}\n", ent.Clsid.ToString("B"));
            }

            return(strRet);
        }
        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);
                    }
                }
            }
        }
Example #25
0
 public ElevatedFactoryServerTypeViewer(COMRegistry registry, COMCLSIDEntry entry, string objName, object obj)
 {
     InitializeComponent();
     _obj      = obj;
     _name     = objName;
     _registry = registry;
     _entry    = entry;
     if (_entry != null && _entry.Elevation != null)
     {
         foreach (COMCLSIDEntry vso in _entry.Elevation.VirtualServerObjects.Select(v => registry.MapClsidToEntry(v)))
         {
             comboBoxClass.Items.Add(vso);
         }
         if (comboBoxClass.Items.Count > 0)
         {
             comboBoxClass.SelectedIndex = 0;
         }
     }
 }
        private void contextMenuStrip_Opening(object sender, CancelEventArgs e)
        {
            TreeNode node = treeComRegistry.SelectedNode;

            if ((node != null) && (node.Tag != null))
            {
                contextMenuStrip.Items.Clear();
                contextMenuStrip.Items.Add(copyGUIDToolStripMenuItem);
                contextMenuStrip.Items.Add(copyGUIDHexStringToolStripMenuItem);
                contextMenuStrip.Items.Add(copyGUIDCStructureToolStripMenuItem);
                if ((node.Tag is COMCLSIDEntry) || (node.Tag is COMProgIDEntry))
                {
                    contextMenuStrip.Items.Add(copyObjectTagToolStripMenuItem);
                    contextMenuStrip.Items.Add(createInstanceToolStripMenuItem);
                    contextMenuStrip.Items.Add(refreshInterfacesToolStripMenuItem);
                    COMProgIDEntry progid = node.Tag as COMProgIDEntry;
                    COMCLSIDEntry  clsid  = node.Tag as COMCLSIDEntry;

                    if (progid != null)
                    {
                        clsid = m_reg.MapClsidToEntry(progid.Clsid);
                    }

                    if (clsid != null && m_reg.Typelibs.ContainsKey(clsid.TypeLib))
                    {
                        contextMenuStrip.Items.Add(viewTypeLibraryToolStripMenuItem);
                    }
                }

                if (node.Tag is COMTypeLibVersionEntry)
                {
                    contextMenuStrip.Items.Add(viewTypeLibraryToolStripMenuItem);
                }
                if (PropertiesControl.SupportsProperties(node.Tag))
                {
                    contextMenuStrip.Items.Add(propertiesToolStripMenuItem);
                }
            }
            else
            {
                e.Cancel = true;
            }
        }
Example #27
0
        /// <summary>
        /// Load CLSID information from the registry key
        /// </summary>
        /// <param name="rootKey">The root registry key, e.g. HKEY_CLASSES_ROOT</param>
        private void LoadCLSIDs(RegistryKey rootKey)
        {
            Dictionary <Guid, COMCLSIDEntry> clsids     = new Dictionary <Guid, COMCLSIDEntry>();
            Dictionary <Guid, List <Guid> >  categories = new Dictionary <Guid, List <Guid> >();

            using (RegistryKey clsidKey = rootKey.OpenSubKey("CLSID"))
            {
                if (clsidKey != null)
                {
                    string[] subkeys = clsidKey.GetSubKeyNames();
                    foreach (string key in subkeys)
                    {
                        Guid clsid;

                        if (Guid.TryParse(key, out clsid))
                        {
                            if (!clsids.ContainsKey(clsid))
                            {
                                using (RegistryKey regKey = clsidKey.OpenSubKey(key))
                                {
                                    if (regKey != null)
                                    {
                                        COMCLSIDEntry ent = new COMCLSIDEntry(clsid, regKey);
                                        clsids.Add(clsid, ent);
                                        foreach (Guid catid in ent.Categories)
                                        {
                                            if (!categories.ContainsKey(catid))
                                            {
                                                categories[catid] = new List <Guid>();
                                            }
                                            categories[catid].Add(ent.Clsid);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            m_clsids     = new SortedDictionary <Guid, COMCLSIDEntry>(clsids);
            m_categories = categories.ToSortedDictionary(p => p.Key, p => new COMCategory(p.Key, p.Value));
        }
Example #28
0
        public static COMProxyInterfaceInstance GetFromIID(COMInterfaceEntry intf, ISymbolResolver resolver)
        {
            if (intf == null || !intf.HasProxy)
            {
                throw new ArgumentException($"Interface {intf.Name} doesn't have a registered proxy");
            }

            COMCLSIDEntry clsid = intf.ProxyClassEntry;

            if (m_proxies.ContainsKey(intf.Iid))
            {
                return(m_proxies[intf.Iid]);
            }
            else
            {
                var instance = new COMProxyInterfaceInstance(clsid, resolver, intf, clsid.Database);
                m_proxies[intf.Iid] = instance;
                return(instance);
            }
        }
        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);
                }
            }
        }
Example #30
0
 private void SetupProcessEntry(COMProcessEntry obj)
 {
     m_process = obj;
     textBoxProcessExecutablePath.Text       = obj.ExecutablePath;
     textBoxProcessProcessId.Text            = obj.ProcessId.ToString();
     textBoxProcessAppId.Text                = GetGuidValue(obj.AppId);
     textBoxProcessAccessPermissions.Text    = GetStringValue(obj.AccessPermissions);
     btnProcessViewAccessPermissions.Enabled = !String.IsNullOrWhiteSpace(obj.AccessPermissions);
     textBoxProcessLrpcPermissions.Text      = GetStringValue(obj.LRpcPermissions);
     textBoxProcessUser.Text     = GetStringValue(obj.User);
     textBoxProcessSecurity.Text = String.Format("Capabilities: {0}, Authn Level: {1}, Imp Level: {2}, Unmarshal Policy: {3}",
                                                 obj.Capabilities, obj.AuthnLevel, obj.ImpLevel, obj.UnmarshalPolicy);
     textBoxProcessStaHwnd.Text = String.Format("0x{0:X}", obj.STAMainHWnd.ToInt64());
     SetupIpidEntries(obj.Ipids, false);
     listViewProcessIPids.ListViewItemSorter = new ListItemComparer(0);
     lblProcess64bit.Text = COMUtilities.FormatBitness(obj.Is64Bit);
     tabControlProperties.TabPages.Add(tabPageProcess);
     if (m_registry.AppIDs.ContainsKey(obj.AppId))
     {
         SetupAppIdEntry((COMAppIDEntry)m_registry.AppIDs[obj.AppId]);
     }
     if (obj.Classes.Any())
     {
         tabControlProperties.TabPages.Add(tabPageRegisteredClasses);
         foreach (var c in obj.Classes)
         {
             COMCLSIDEntry clsid = m_registry.MapClsidToEntry(c.Clsid);
             ListViewItem  item  = listViewRegisteredClasses.Items.Add(c.Clsid.FormatGuid());
             item.SubItems.Add(clsid.Name);
             item.SubItems.Add(c.VTable);
             item.SubItems.Add(c.RegFlags.ToString());
             item.SubItems.Add(c.Apartment.ToString());
             item.SubItems.Add(c.Context.ToString());
             item.Tag = c;
         }
         listViewRegisteredClasses.ListViewItemSorter = new ListItemComparer(0);
         listViewRegisteredClasses.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
         listViewRegisteredClasses.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
     }
 }