示例#1
0
        internal COMCLSIDEntry(COMRegistry registry, Guid clsid, COMPackagedEntry packageEntry,
                               COMPackagedClassEntry classEntry) : this(registry, clsid)
        {
            Source    = COMRegistryEntrySource.Packaged;
            Name      = classEntry.DisplayName;
            PackageId = packageEntry.PackageId;

            Dictionary <COMServerType, COMCLSIDServerEntry> servers = new Dictionary <COMServerType, COMCLSIDServerEntry>();

            if (!string.IsNullOrWhiteSpace(classEntry.DllPath))
            {
                servers.Add(COMServerType.InProcServer32, new COMCLSIDServerEntry(COMServerType.InProcServer32, classEntry.DllPath, classEntry.Threading));
            }

            if (packageEntry.Servers.ContainsKey(classEntry.ServerId))
            {
                COMPackagedServerEntry server = packageEntry.Servers[classEntry.ServerId];
                AppID = server.SurrogateAppId;
                string serverPath  = "<APPID HOSTED>";
                string commandLine = string.Empty;
                if (AppID == Guid.Empty)
                {
                    serverPath  = server.Executable;
                    commandLine = server.CommandLine;
                }
                servers.Add(COMServerType.LocalServer32, new COMCLSIDServerEntry(COMServerType.LocalServer32, serverPath, commandLine));
            }

            Servers    = new ReadOnlyDictionary <COMServerType, COMCLSIDServerEntry>(servers);
            Categories = classEntry.ImplementedCategories.AsReadOnly();
        }
示例#2
0
        internal COMPackagedRegistry(RegistryKey rootKey)
        {
            var packages = new Dictionary <string, COMPackagedEntry>();

            Packages = packages;

            using (var packageKey = rootKey.OpenSubKeySafe("Package"))
            {
                if (packageKey == null)
                {
                    return;
                }

                foreach (var packageName in packageKey.GetSubKeyNames())
                {
                    using (var packageNameKey = packageKey.OpenSubKeySafe(packageName))
                    {
                        if (packageNameKey != null)
                        {
                            packages[packageName] = new COMPackagedEntry(packageName, packageNameKey);
                        }
                    }
                }
            }
        }
示例#3
0
        internal COMCLSIDEntry(COMRegistry registry, Guid clsid, COMPackagedEntry packageEntry,
                               COMPackagedProxyStubEntry proxyEntry) : this(registry, clsid)
        {
            Source    = COMRegistryEntrySource.Packaged;
            Name      = proxyEntry.DisplayName;
            PackageId = packageEntry.PackageId;

            Dictionary <COMServerType, COMCLSIDServerEntry> servers = new Dictionary <COMServerType, COMCLSIDServerEntry>();
            string dllPath = Environment.Is64BitProcess ? proxyEntry.DllPath_x64 : proxyEntry.DllPath_x86;

            if (string.IsNullOrWhiteSpace(dllPath))
            {
                dllPath = proxyEntry.DllPath;
            }
            if (!string.IsNullOrWhiteSpace(dllPath))
            {
                servers.Add(COMServerType.InProcServer32, new COMCLSIDServerEntry(COMServerType.InProcServer32, dllPath, COMThreadingModel.Both));
            }

            Servers = new ReadOnlyDictionary <COMServerType, COMCLSIDServerEntry>(servers);
        }