Ejemplo n.º 1
0
 public void AddDataRow(AddInData addInData)
 {
     addInData.SetUnknownValues();
     if (!string.IsNullOrEmpty(addInData.StatusDescription))
     {
         addInData.StatusImage = Resources.WarningImage;
     }
     this.dataTable.Rows.Add(
         (object)this.item,
         (object)addInData.HostName,
         (object)addInData.IsRunning,
         (object)addInData.IsLoaded,
         (object)addInData.AddInType,
         (object)addInData.FriendlyName,
         (object)addInData.ProgId,
         (object)addInData.Clsid,
         (object)addInData.ManifestPath,
         (object)addInData.AssemblyPath,
         (object)addInData.LoadBehavior,
         (object)addInData.RegHiveName,
         (object)addInData.AssemblyName,
         (object)addInData.ClrVersion,
         (object)addInData.IsObjectExposed,
         (object)addInData.SupportedInterfaces,
         (object)addInData.OutlookFormRegions,
         (object)addInData.VstoRuntime,
         (object)addInData.InstallDate,
         (object)addInData.AssemblyVersion,
         (object)addInData.StatusImage,
         (object)addInData.Status,
         (object)addInData.StatusDescription
         );
     ++this.item;
 }
Ejemplo n.º 2
0
 public void AddDataRow(AddInData addInData)
 {
     addInData.SetUnknownValues();
       if (!string.IsNullOrEmpty(addInData.StatusDescription))
     addInData.StatusImage = Resources.WarningImage;
       this.dataTable.Rows.Add(
       (object) this.item,
       (object) addInData.HostName,
       (object) addInData.IsRunning,
       (object) addInData.IsLoaded,
       (object) addInData.AddInType,
       (object) addInData.FriendlyName,
       (object) addInData.ProgId,
       (object) addInData.Clsid,
       (object) addInData.ManifestPath,
       (object) addInData.AssemblyPath,
       (object) addInData.LoadBehavior,
       (object) addInData.RegHiveName,
       (object) addInData.AssemblyName,
       (object) addInData.ClrVersion,
       (object) addInData.IsObjectExposed,
       (object) addInData.SupportedInterfaces,
       (object) addInData.OutlookFormRegions,
       (object) addInData.VstoRuntime,
       (object) addInData.InstallDate,
       (object) addInData.AssemblyVersion,
       (object) addInData.StatusImage,
       (object) addInData.Status,
       (object) addInData.StatusDescription
       );
       ++this.item;
 }
Ejemplo n.º 3
0
 internal static NativeMethods.COMAddIn GetLoadedCOMAddInObjects(ref AddInData addInData)
 {
     addInData.IsRunning = false;
       addInData.IsLoaded = false;
       addInData.IsObjectExposed = false;
       object app = (object) null;
       NativeMethods.COMAddIn comAddIn = (NativeMethods.COMAddIn) null;
       addInData.IsRunning = ComAddInUtilities.GetRunningApplicationObject(addInData.HostName, out app);
       if (addInData.IsRunning)
       {
     addInData.IsLoaded = ComAddInUtilities.GetCOMAddIn(app, addInData.ProgId, out comAddIn);
     if (addInData.IsLoaded && comAddIn.Object != null)
       addInData.IsObjectExposed = true;
       }
       return comAddIn;
 }
Ejemplo n.º 4
0
        internal static NativeMethods.COMAddIn GetLoadedCOMAddInObjects(ref AddInData addInData)
        {
            addInData.IsRunning       = false;
            addInData.IsLoaded        = false;
            addInData.IsObjectExposed = false;
            object app = (object)null;

            NativeMethods.COMAddIn comAddIn = (NativeMethods.COMAddIn)null;
            addInData.IsRunning = ComAddInUtilities.GetRunningApplicationObject(addInData.HostName, out app);
            if (addInData.IsRunning)
            {
                addInData.IsLoaded = ComAddInUtilities.GetCOMAddIn(app, addInData.ProgId, out comAddIn);
                if (addInData.IsLoaded && comAddIn.Object != null)
                {
                    addInData.IsObjectExposed = true;
                }
            }
            return(comAddIn);
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
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);
       }
 }