コード例 #1
0
        private void LoadProgIDs(RegistryKey rootKey)
        {
            m_progids        = new SortedDictionary <string, COMProgIDEntry>();
            m_progidsbyclsid = new Dictionary <Guid, List <COMProgIDEntry> >();

            string[] subkeys = rootKey.GetSubKeyNames();
            foreach (string key in subkeys)
            {
                try
                {
                    using (RegistryKey regKey = rootKey.OpenSubKey(key))
                    {
                        Guid clsid = COMUtilities.ReadGuidFromKey(regKey, "CLSID", null);
                        if (clsid != Guid.Empty)
                        {
                            COMProgIDEntry entry = new COMProgIDEntry(key, clsid, regKey);
                            m_progids.Add(key, entry);
                            if (!m_progidsbyclsid.ContainsKey(clsid))
                            {
                                m_progidsbyclsid[clsid] = new List <COMProgIDEntry>();
                            }

                            m_progidsbyclsid[clsid].Add(entry);
                        }
                    }
                }
                catch (FormatException e)
                {
                    System.Diagnostics.Debug.WriteLine(e.ToString());
                }
            }
        }
コード例 #2
0
        private void LoadProgIDs(RegistryKey rootKey)
        {
            Dictionary <string, COMProgIDEntry> progids = new Dictionary <string, COMProgIDEntry>(StringComparer.OrdinalIgnoreCase);

            string[] subkeys = rootKey.GetSubKeyNames();
            foreach (string key in subkeys)
            {
                try
                {
                    using (RegistryKey regKey = rootKey.OpenSubKey(key))
                    {
                        Guid clsid = COMUtilities.ReadGuid(regKey, "CLSID", null);
                        if (clsid != Guid.Empty)
                        {
                            COMProgIDEntry entry = new COMProgIDEntry(this, key, clsid, regKey);
                            progids[key] = entry;
                        }
                    }
                }
                catch (FormatException)
                {
                }
            }
            m_progids = new SortedDictionary <string, COMProgIDEntry>(progids, StringComparer.OrdinalIgnoreCase);
        }
コード例 #3
0
        private void copyObjectTagToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = treeComRegistry.SelectedNode;
            Guid     guid = Guid.Empty;

            if (node != null)
            {
                if (node.Tag is COMCLSIDEntry)
                {
                    guid = ((COMCLSIDEntry)node.Tag).Clsid;
                }
                else if (node.Tag is COMProgIDEntry)
                {
                    COMProgIDEntry ent = (COMProgIDEntry)node.Tag;
                    if (m_reg.MapClsidToEntry(ent.Clsid) != null)
                    {
                        guid = ent.Clsid;
                    }
                }

                if (guid != Guid.Empty)
                {
                    CopyGuidToClipboard(guid, CopyGuidType.CopyAsObject);
                }
            }
        }
コード例 #4
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);
            }
        }
コード例 #5
0
        /// <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);
        }
コード例 #6
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;
            }
        }
コード例 #7
0
        private void SetupProperties(object obj)
        {
            if (obj is COMCLSIDEntry)
            {
                SetupClsidEntry((COMCLSIDEntry)obj);
            }

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

            if (obj is COMAppIDEntry)
            {
                SetupAppIdEntry((COMAppIDEntry)obj);
            }
        }
コード例 #8
0
        private Guid GetGuidFromType(TreeNode node)
        {
            Guid guid = Guid.Empty;

            if (node != null)
            {
                object tag = node.Tag;
                if (tag is COMCLSIDEntry)
                {
                    guid = ((COMCLSIDEntry)tag).Clsid;
                }
                else if (tag is COMInterfaceEntry)
                {
                    guid = ((COMInterfaceEntry)tag).Iid;
                }
                else if (tag is COMProgIDEntry)
                {
                    COMProgIDEntry ent = (COMProgIDEntry)tag;
                    if (m_reg.MapClsidToEntry(ent.Clsid) != null)
                    {
                        guid = ent.Clsid;
                    }
                }
                else if (tag is COMTypeLibEntry)
                {
                    guid = ((COMTypeLibEntry)tag).TypelibId;
                }
                else if (tag is Guid)
                {
                    guid = (Guid)tag;
                }
                else if (tag is COMAppIDEntry)
                {
                    guid = ((COMAppIDEntry)tag).AppId;
                }
            }

            return(guid);
        }
コード例 #9
0
        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);
                    }
                }
            }
        }
コード例 #10
0
 private void LoadProgIDs(RegistryKey rootKey)
 {
     m_progids = new SortedDictionary <string, COMProgIDEntry>();
     string[] subkeys = rootKey.GetSubKeyNames();
     foreach (string key in subkeys)
     {
         try
         {
             using (RegistryKey regKey = rootKey.OpenSubKey(key))
             {
                 Guid clsid = COMUtilities.ReadGuidFromKey(regKey, "CLSID", null);
                 if (clsid != Guid.Empty)
                 {
                     COMProgIDEntry entry = new COMProgIDEntry(key, clsid, regKey);
                     m_progids.Add(key, entry);
                 }
             }
         }
         catch (FormatException)
         {
         }
     }
 }
コード例 #11
0
ファイル: COMRegistry.cs プロジェクト: tuantmb/oleviewdotnet
        private void LoadProgIDs(RegistryKey rootKey, ActivationContext actctx)
        {
            Dictionary <string, COMProgIDEntry> progids = new Dictionary <string, COMProgIDEntry>(StringComparer.OrdinalIgnoreCase);

            if (actctx != null)
            {
                foreach (var progid in actctx.ComProgIds)
                {
                    progids[progid.ProgId] = new COMProgIDEntry(this, progid);
                }
            }

            string[] subkeys = rootKey.GetSubKeyNames();
            foreach (string key in subkeys)
            {
                if (progids.ContainsKey(key))
                {
                    continue;
                }
                try
                {
                    using (RegistryKey regKey = rootKey.OpenSubKey(key))
                    {
                        Guid clsid = COMUtilities.ReadGuid(regKey, "CLSID", null);
                        if (clsid != Guid.Empty)
                        {
                            COMProgIDEntry entry = new COMProgIDEntry(this, key, clsid, regKey);
                            progids[key] = entry;
                        }
                    }
                }
                catch (FormatException)
                {
                }
            }
            m_progids = new SortedDictionary <string, COMProgIDEntry>(progids, StringComparer.OrdinalIgnoreCase);
        }