示例#1
0
        internal bool GetManagedAddInData(bool scanManagedInterfaces)
        {
            bool flag = true;

            this.assemblyName        = (string)null;
            this.clrVersion          = (string)null;
            this.supportedInterfaces = (string)null;
            this.addInType           = Resources.ADDIN_TYPE_MANAGED;
            this.assemblyPath        = RegistryReader.GetInprocServerFromClsid(this.clsid, "CodeBase");
            if (this.assemblyPath != null && File.Exists(this.assemblyPath))
            {
                string[] assemblyInfo = AssemblyScanner.GetAssemblyInfo(this.assemblyPath, this.hostName, false);
                this.assemblyName        = assemblyInfo[0];
                this.clrVersion          = assemblyInfo[1];
                this.supportedInterfaces = !scanManagedInterfaces ? (string)null : this.GetSupportedInterfaces(assemblyInfo);
            }
            else
            {
                flag = false;
                this.assemblyName        = (string)null;
                this.clrVersion          = (string)null;
                this.supportedInterfaces = (string)null;
            }
            this.vstoRuntime = Resources.NOT_APPLICABLE;
            return(flag);
        }
示例#2
0
        private void EnumerateRegisteredAddIns(RegistryKey regHive, string hostName)
        {
            string              regHiveName           = (string)null;
            List <string>       officeRegKeyNames     = new List <string>();
            NameValueCollection registeredFormRegions = (NameValueCollection)null;

            RegistryReader.GetAddInsRegHiveNames(regHive, hostName, out regHiveName, officeRegKeyNames);
            foreach (string officeRegKeyName in officeRegKeyNames)
            {
                EvaluateRegisteredAddIn(regHive, hostName, regHiveName, ref registeredFormRegions, officeRegKeyName);
            }
        }
示例#3
0
 internal void GetData(RegistryKey addInKey, bool scanManagedInterfaces, bool scanNativeInterfaces, bool scanRemote, ref bool isUncPath, ref bool isHttpPath, ref bool isDllPathValid, ref bool isValidRegistration)
 {
     this.friendlyName = (string)addInKey.GetValue("FriendlyName");
     this.clsid        = RegistryReader.GetCLSIDFromProgID(this.progId);
     this.loadBehavior = addInKey.GetValue("LoadBehavior").ToString();
     this.manifestPath = (string)addInKey.GetValue("Manifest");
     if (this.manifestPath == null && string.IsNullOrEmpty(this.clsid))
     {
         this.SetInvalidRegistration();
         isDllPathValid      = false;
         isValidRegistration = false;
     }
     else
     {
         if (this.manifestPath != null)
         {
             isDllPathValid = this.GetVstoAddInData(scanManagedInterfaces, scanRemote, ref isUncPath, ref isHttpPath);
             if (!isDllPathValid || this.assemblyName == null || this.clrVersion == null)
             {
                 this.SetInvalidPath();
             }
         }
         else
         {
             this.manifestPath = Resources.NOT_APPLICABLE;
             if (RegistryReader.GetIsManagedCodeCategoryRegistered(this.clsid) || RegistryReader.GetIsMscoreeRegistered(this.clsid))
             {
                 isDllPathValid = this.GetManagedAddInData(scanManagedInterfaces);
             }
             else
             {
                 bool isNativeScanCompleted = false;
                 isDllPathValid = this.GetNativeAddInData(scanNativeInterfaces, out isNativeScanCompleted);
                 if (!isNativeScanCompleted)
                 {
                     this.SetNativeScanFailed();
                 }
             }
         }
         if (this.assemblyPath != null && isDllPathValid)
         {
             this.CleanAssemblyPath(ref this.assemblyPath, ref isDllPathValid);
         }
         else
         {
             this.statusDescription = Resources.PATH_INVALID;
         }
     }
 }
示例#4
0
        internal static bool ReadResiliencyRegistryKeys(string hostName, string addInPath, string addInFriendlyName, out string disabledStatus)
        {
            disabledStatus = string.Empty;
            bool flag = false;

            string[] strArray = new string[2]
            {
                "11.0",
                "12.0"
            };
            foreach (string officeVersion in strArray)
            {
                if (RegistryReader.ReadDisabledItems(hostName, officeVersion, addInPath, addInFriendlyName))
                {
                    string str = string.Format(Resources.ADDIN_DISABLED, (object)hostName, (object)officeVersion);
                    disabledStatus = disabledStatus.Length != 0 ? string.Format("{0} {1}", (object)disabledStatus, (object)str) : str;
                    flag           = true;
                }
            }
            return(flag);
        }
示例#5
0
        internal bool GetNativeAddInData(bool scanNativeInterfaces, out bool isNativeScanCompleted)
        {
            bool flag = true;

            this.addInType           = Resources.ADDIN_TYPE_NATIVE;
            this.assemblyPath        = (string)null;
            this.assemblyName        = Resources.NOT_APPLICABLE;
            this.clrVersion          = Resources.NOT_APPLICABLE;
            this.vstoRuntime         = Resources.NOT_APPLICABLE;
            this.supportedInterfaces = (string)null;
            isNativeScanCompleted    = true;
            string inprocServerFromClsid = RegistryReader.GetInprocServerFromClsid(this.clsid, "");

            if (inprocServerFromClsid != null)
            {
                this.assemblyPath = inprocServerFromClsid.Trim('"');
            }
            else
            {
                flag = false;
            }
            if (scanNativeInterfaces)
            {
                if (this.assemblyPath != null && File.Exists(this.assemblyPath))
                {
                    this.supportedInterfaces = new NativeAddInScanner(this.hostName).GetSupportedInterfaces(this.clsid);
                    if (this.supportedInterfaces == null)
                    {
                        isNativeScanCompleted = false;
                    }
                }
                else
                {
                    flag = false;
                }
            }
            return(flag);
        }
示例#6
0
        internal void ScanForDisabledItems()
        {
            string hostName = this.hostName;

            if (this.addInType == "Managed")
            {
                this.assemblyPath = "mscoree.dll";
            }
            if (this.hostName == "Project")
            {
                hostName = "MS Project";
            }
            string disabledStatus = string.Empty;

            RegistryReader.ReadResiliencyRegistryKeys(hostName, this.assemblyPath, this.friendlyName, out disabledStatus);
            if (string.IsNullOrEmpty(disabledStatus))
            {
                return;
            }
            this.statusImage       = Resources.WarningImage;
            this.status            = false;
            this.statusDescription = !string.IsNullOrEmpty(this.statusDescription) ? string.Format("{0} {1}", (object)this.statusDescription, (object)disabledStatus) : disabledStatus;
        }
示例#7
0
        private void EnumerateRegisteredAddIns(RegistryKey regHive, string hostName)
        {
            string regHiveName      = (string)null;
            string officeRegKeyName = (string)null;
            NameValueCollection registeredFormRegions = (NameValueCollection)null;

            RegistryReader.GetAddInsRegHiveNames(regHive, hostName, out regHiveName, out officeRegKeyName);
            try
            {
                if (hostName == "Outlook" && this.scanFormRegions)
                {
                    registeredFormRegions = RegistryReader.ReadFormRegionRegistrations(regHive);
                }
                using (RegistryKey registryKey = regHive.OpenSubKey(officeRegKeyName))
                {
                    if (registryKey == null)
                    {
                        return;
                    }
                    foreach (string progId in registryKey.GetSubKeyNames())
                    {
                        bool isDllPathValid             = true;
                        NativeMethods.COMAddIn comAddIn = (NativeMethods.COMAddIn)null;
                        bool isValidRegistration        = true;
                        this.isUncPath       = false;
                        this.isHttpPath      = false;
                        Globals.ErrorMessage = (string)null;
                        AddInData addInData = new AddInData(hostName, regHiveName, progId);
                        if (this.progIdsFound.Contains(addInData.ProgId))
                        {
                            addInData.StatusDescription = Resources.REGISTERED_MULTIPLE_TIMES;
                        }
                        else
                        {
                            this.progIdsFound.Add(addInData.ProgId);
                        }
                        try
                        {
                            using (RegistryKey addInKey = registryKey.OpenSubKey(addInData.ProgId))
                            {
                                if (addInKey != null)
                                {
                                    addInData.GetData(addInKey, this.scanManagedInterfaces, this.scanNativeInterfaces, this.scanRemote, ref this.isUncPath, ref this.isHttpPath, ref isDllPathValid, ref isValidRegistration);
                                }
                                else
                                {
                                    addInData.SetInvalidAddInKey();
                                }
                                if (isValidRegistration)
                                {
                                    comAddIn = ComAddInUtilities.GetLoadedCOMAddInObjects(ref addInData);
                                    if (this.isHttpPath)
                                    {
                                        addInData.StatusDescription = Resources.HTTP_PARTIAL_INFORMATION;
                                    }
                                    else if (!this.scanRemote && this.isUncPath)
                                    {
                                        addInData.StatusDescription = Resources.REMOTE_NOT_SELECTED;
                                    }
                                    else if (addInData.AssemblyPath != null && isDllPathValid)
                                    {
                                        addInData.InstallDate = this.GetAddInInstallDate(addInData.AssemblyPath);
                                    }
                                    else
                                    {
                                        addInData.SetInvalidPath();
                                    }
                                    if (addInData.AssemblyPath != null && addInData.AssemblyPath.EndsWith(".deploy"))
                                    {
                                        addInData.AssemblyPath = addInData.AssemblyPath.Substring(0, addInData.AssemblyPath.IndexOf(".deploy"));
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Globals.AddException(ex);
                        }
                        if (Globals.ErrorMessage != null && Globals.ErrorMessage.Length > 0)
                        {
                            addInData.StatusDescription = !string.IsNullOrEmpty(addInData.StatusDescription) ? string.Format("{0} {1}", (object)addInData.StatusDescription, (object)Globals.ErrorMessage) : Globals.ErrorMessage;
                        }
                        if (this.scanDisabled)
                        {
                            addInData.ScanForDisabledItems();
                        }
                        if (addInData.HostName == "Outlook" && this.scanFormRegions)
                        {
                            addInData.ScanForFormRegions(registeredFormRegions);
                        }
                        this.gridProxy.AddDataRow(addInData);
                    }
                }
            }
            catch (Exception ex)
            {
                Globals.AddException(ex);
            }
        }