/// <summary>
        /// Overrides the <paramref name="configurationObject"/>'s properties with the Group Policy values from the
        /// registry.
        /// </summary>
        /// <param name="configurationObject">The configuration object for instances that must be managed.</param>
        /// <param name="policyKey">The <see cref="IRegistryKey"/> which holds the Group Policy overrides for the
        /// configuration element.</param>
        /// <remarks>Subclasses implementing this method must retrieve all the override values from the registry
        /// before making modifications to the <paramref name="configurationObject"/> so any error retrieving
        /// the override values will cancel policy processing.</remarks>
        protected override void OverrideWithGroupPolicies(RollingFlatFileTraceListenerData configurationObject,
                                                          IRegistryKey policyKey)
        {
            String fileNameOverride  = policyKey.GetStringValue(FileNamePropertyName);
            String formatterOverride = GetFormatterPolicyOverride(policyKey);
            RollFileExistsBehavior?rollFileExistsBehaviorOverride = policyKey.GetEnumValue <RollFileExistsBehavior>(RollFileExistsBehaviorPropertyName);
            RollInterval?          rollIntervalOverride           = policyKey.GetEnumValue <RollInterval>(RollIntervalPropertyName);
            int?         rollSizeKBOverride         = policyKey.GetIntValue(RollSizeKBPropertyName);
            string       timeStampPatternOverride   = policyKey.GetStringValue(TimeStampPatternPropertyName);
            TraceOptions?traceOutputOptionsOverride = policyKey.GetEnumValue <TraceOptions>(TraceOutputOptionsPropertyName);
            SourceLevels?filterOverride             = policyKey.GetEnumValue <SourceLevels>(FilterPropertyName);
            string       headerOverride             = policyKey.GetStringValue(HeaderPropertyName);
            string       footerOverride             = policyKey.GetStringValue(FooterPropertyName);

            configurationObject.FileName  = fileNameOverride;
            configurationObject.Header    = headerOverride;
            configurationObject.Footer    = footerOverride;
            configurationObject.Formatter = formatterOverride;
            configurationObject.RollFileExistsBehavior = rollFileExistsBehaviorOverride.Value;
            configurationObject.RollInterval           = rollIntervalOverride.Value;
            configurationObject.RollSizeKB             = rollSizeKBOverride.Value;
            configurationObject.TimeStampPattern       = timeStampPatternOverride;
            configurationObject.TraceOutputOptions     = traceOutputOptionsOverride.Value;
            configurationObject.Filter = filterOverride.Value;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Overrides the <paramref name="configurationObject"/>'s properties with the Group Policy values from the
        /// registry.
        /// </summary>
        /// <param name="configurationObject">The configuration object for instances that must be managed.</param>
        /// <param name="policyKey">The <see cref="IRegistryKey"/> which holds the Group Policy overrides for the
        /// configuration element.</param>
        /// <remarks>Subclasses implementing this method must retrieve all the override values from the registry
        /// before making modifications to the <paramref name="configurationObject"/> so any error retrieving
        /// the override values will cancel policy processing.</remarks>
        protected override void OverrideWithGroupPolicies(MsmqTraceListenerData configurationObject,
                                                          IRegistryKey policyKey)
        {
            String          formatterOverride          = GetFormatterPolicyOverride(policyKey);
            MessagePriority?messagePriorityOverride    = policyKey.GetEnumValue <MessagePriority>(MessagePriorityPropertyName);
            String          queuePathOverride          = policyKey.GetStringValue(QueuePathPropertyName);
            bool?           recoverableOverride        = policyKey.GetBoolValue(RecoverablePropertyName);
            TimeSpan        timeToBeReceivedOverride   = GetTimeSpanOverride(policyKey, TimeToBeReceivedPropertyName);
            TimeSpan        timeToReachQueueOverride   = GetTimeSpanOverride(policyKey, TimeToReachQueuePropertyName);
            TraceOptions?   traceOutputOptionsOverride =
                GetFlagsEnumOverride <TraceOptions>(policyKey, TraceOutputOptionsPropertyName);
            SourceLevels?filterOverride = policyKey.GetEnumValue <SourceLevels>(FilterPropertyName);
            MessageQueueTransactionType?transactionTypeOverride =
                policyKey.GetEnumValue <MessageQueueTransactionType>(TransactionTypePropertyName);
            bool?usedAuthenticationOverride = policyKey.GetBoolValue(UseAuthenticationPropertyName);
            bool?useDeadLetterOverride      = policyKey.GetBoolValue(UseDeadLetterQueuePropertyName);
            bool?useEncryptionOverride      = policyKey.GetBoolValue(UseEncryptionPropertyName);

            configurationObject.Formatter          = formatterOverride;
            configurationObject.MessagePriority    = messagePriorityOverride.Value;
            configurationObject.QueuePath          = queuePathOverride;
            configurationObject.Recoverable        = recoverableOverride.Value;
            configurationObject.TimeToReachQueue   = timeToReachQueueOverride;
            configurationObject.TimeToBeReceived   = timeToBeReceivedOverride;
            configurationObject.TraceOutputOptions = traceOutputOptionsOverride.Value;
            configurationObject.Filter             = filterOverride.Value;
            configurationObject.TransactionType    = transactionTypeOverride.Value;
            configurationObject.UseAuthentication  = usedAuthenticationOverride.Value;
            configurationObject.UseDeadLetterQueue = useDeadLetterOverride.Value;
            configurationObject.UseEncryption      = useEncryptionOverride.Value;
        }
Ejemplo n.º 3
0
        protected override void OverrideWithGroupPolicies(WmiTraceListenerData configurationObject,
                                                          IRegistryKey policyKey)
        {
            TraceOptions?traceOutputOptionsOverride = policyKey.GetEnumValue <TraceOptions>(TraceOutputOptionsPropertyName);
            SourceLevels?filterOverride             = policyKey.GetEnumValue <SourceLevels>(FilterPropertyName);

            configurationObject.TraceOutputOptions = traceOutputOptionsOverride.Value;
            configurationObject.Filter             = filterOverride.Value;
        }
Ejemplo n.º 4
0
        protected override void OverrideWithGroupPolicies(T configurationObject, IRegistryKey policyKey)
        {
            String       initDataOverride           = policyKey.GetStringValue(InitDataPropertyName);
            TraceOptions?traceOutputOptionsOverride = policyKey.GetEnumValue <TraceOptions>(TraceOutputOptionsPropertyName);
            SourceLevels?filterOverride             = policyKey.GetEnumValue <SourceLevels>(FilterPropertyName);

            base.OverrideWithGroupPolicies(configurationObject, policyKey);
            configurationObject.InitData           = initDataOverride;
            configurationObject.TraceOutputOptions = traceOutputOptionsOverride.Value;
            configurationObject.Filter             = filterOverride.Value;
        }
        protected override void OverrideWithGroupPolicies(FlatFileTraceListenerData configurationObject, IRegistryKey policyKey)
        {
            String       fileNameOverride           = policyKey.GetStringValue(FileNamePropertyName);
            String       footerOverride             = policyKey.GetStringValue(FooterPropertyName);
            String       formatterOverride          = GetFormatterPolicyOverride(policyKey);
            String       headerOverride             = policyKey.GetStringValue(HeaderPropertyName);
            TraceOptions?traceOutputOptionsOverride = policyKey.GetEnumValue <TraceOptions>(TraceOutputOptionsPropertyName);
            SourceLevels?filterOverride             = policyKey.GetEnumValue <SourceLevels>(FilterPropertyName);

            configurationObject.FileName           = fileNameOverride;
            configurationObject.Footer             = footerOverride;
            configurationObject.Formatter          = formatterOverride;
            configurationObject.Header             = headerOverride;
            configurationObject.TraceOutputOptions = traceOutputOptionsOverride.Value;
            configurationObject.Filter             = filterOverride.Value;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Overrides the <paramref name="configurationObject"/>'s properties with the Group Policy values from the
        /// registry.
        /// </summary>
        /// <param name="configurationObject">The configuration object for instances that must be managed.</param>
        /// <param name="policyKey">The <see cref="IRegistryKey"/> which holds the Group Policy overrides for the
        /// configuration element.</param>
        /// <remarks>Subclasses implementing this method must retrieve all the override values from the registry
        /// before making modifications to the <paramref name="configurationObject"/> so any error retrieving
        /// the override values will cancel policy processing.</remarks>
        protected override void OverrideWithGroupPolicies(DpapiSymmetricCryptoProviderData configurationObject,
                                                          IRegistryKey policyKey)
        {
            DataProtectionScope?scopeOverride = policyKey.GetEnumValue <DataProtectionScope>(ScopePropertyName);

            configurationObject.Scope = scopeOverride.Value;
        }
Ejemplo n.º 7
0
        protected override void OverrideWithGroupPolicies(XmlTraceListenerData configurationObject, IRegistryKey policyKey)
        {
            String       fileNameOverride           = policyKey.GetStringValue(FileNamePropertyName);
            TraceOptions?traceOutputOptionsOverride = policyKey.GetEnumValue <TraceOptions>(TraceOutputOptionsPropertyName);

            configurationObject.FileName           = fileNameOverride;
            configurationObject.TraceOutputOptions = traceOutputOptionsOverride.Value;
        }
Ejemplo n.º 8
0
        protected override void OverrideWithGroupPolicies(FormattedEventLogTraceListenerData configurationObject,
                                                          IRegistryKey policyKey)
        {
            String       formatterOverride          = GetFormatterPolicyOverride(policyKey);
            String       logOverride                = policyKey.GetStringValue(LogPropertyName);
            String       machineNameOverride        = policyKey.GetStringValue(MachineNamePropertyName);
            String       sourceOverride             = policyKey.GetStringValue(SourcePropertyName);
            TraceOptions?traceOutputOptionsOverride = policyKey.GetEnumValue <TraceOptions>(TraceOutputOptionsPropertyName);
            SourceLevels?filterOverride             = policyKey.GetEnumValue <SourceLevels>(FilterPropertyName);

            configurationObject.Formatter          = formatterOverride;
            configurationObject.Log                = logOverride;
            configurationObject.MachineName        = machineNameOverride;
            configurationObject.Source             = sourceOverride;
            configurationObject.TraceOutputOptions = traceOutputOptionsOverride.Value;
            configurationObject.Filter             = filterOverride.Value;
        }
Ejemplo n.º 9
0
        private bool OverrideWithGroupPoliciesAndGenerateWmiObjectsForTraceSource(TraceSourceData traceSourceData,
                                                                                  bool readGroupPolicies, IRegistryKey machineKey, IRegistryKey userKey,
                                                                                  bool generateWmiObjects, ICollection <ConfigurationSetting> wmiSettings,
                                                                                  String sourceKind)
        {
            if (readGroupPolicies)
            {
                IRegistryKey policyKey = machineKey != null ? machineKey : userKey;
                if (policyKey != null)
                {
                    if (policyKey.IsPolicyKey && !policyKey.GetBoolValue(PolicyValueName).Value)
                    {
                        return(false);
                    }
                    try
                    {
                        SourceLevels?defaultLevelOverride = policyKey.GetEnumValue <SourceLevels>(SourceDefaultLevelPropertyName);

                        // the key where the values for the source listeners are stored
                        // might not exist if no listener is selected
                        traceSourceData.TraceListeners.Clear();
                        using (IRegistryKey listenersOverrideKey = policyKey.OpenSubKey(SourceTraceListenersPropertyName))
                        {
                            if (listenersOverrideKey != null)
                            {
                                foreach (String valueName in listenersOverrideKey.GetValueNames())
                                {
                                    traceSourceData.TraceListeners.Add(new TraceListenerReferenceData(valueName));
                                }
                            }
                        }
                        traceSourceData.DefaultLevel = defaultLevelOverride.Value;
                    }
                    catch (RegistryAccessException ex)
                    {
                        LogExceptionWhileOverriding(ex);
                    }
                }
            }
            if (generateWmiObjects)
            {
                String[] referencedTraceListeners = new String[traceSourceData.TraceListeners.Count];
                for (int i = 0; i < traceSourceData.TraceListeners.Count; i++)
                {
                    referencedTraceListeners[i]
                        = traceSourceData.TraceListeners.Get(i).Name;
                }

                wmiSettings.Add(
                    new TraceSourceSetting(
                        traceSourceData.Name,
                        traceSourceData.DefaultLevel.ToString(),
                        referencedTraceListeners,
                        sourceKind));
            }

            return(true);
        }
        private bool OverrideWithGroupPolicyTypeTypesAndGenerateWmiObjectsForPolicyType(ExceptionTypeData exceptionType,
                                                                                        ExceptionPolicyData parentPolicy,
                                                                                        bool readGroupPolicies, IRegistryKey machineKey, IRegistryKey userKey,
                                                                                        bool generateWmiObjects, ICollection <ConfigurationSetting> wmiSettings)
        {
            if (readGroupPolicies)
            {
                IRegistryKey policyKey = machineKey != null ? machineKey : userKey;
                if (policyKey != null)
                {
                    if (policyKey.IsPolicyKey && !policyKey.GetBoolValue(PolicyValueName).Value)
                    {
                        return(false);
                    }
                    try
                    {
                        PostHandlingAction?postHandlingActionOverride
                            = policyKey.GetEnumValue <PostHandlingAction>(PolicyTypePostHandlingActionPropertyName);

                        exceptionType.PostHandlingAction = postHandlingActionOverride.Value;
                    }
                    catch (RegistryAccessException ex)
                    {
                        LogExceptionWhileOverriding(ex);
                    }
                }
            }
            if (generateWmiObjects)
            {
                ExceptionTypeSetting wmiSetting
                    = new ExceptionTypeSetting(exceptionType.Name,
                                               exceptionType.Type.AssemblyQualifiedName,
                                               exceptionType.PostHandlingAction.ToString());
                wmiSetting.Policy = parentPolicy.Name;
                wmiSettings.Add(wmiSetting);
            }

            List <ConfigurationSetting> handlerSettings = new List <ConfigurationSetting>(exceptionType.ExceptionHandlers.Count);

            OverrideWithGroupPoliciesAndGenerateWmiObjectsForElementCollection(exceptionType.ExceptionHandlers,
                                                                               PolicyTypeHandlersPropertyName,
                                                                               readGroupPolicies, machineKey, userKey,
                                                                               generateWmiObjects, handlerSettings);

            int i = 0;

            foreach (ExceptionHandlerSetting setting in handlerSettings)
            {
                setting.Policy        = parentPolicy.Name;
                setting.ExceptionType = exceptionType.Name;
                setting.Order         = i++;
                wmiSettings.Add(setting);
            }

            return(true);
        }
        private bool OverrideWithGroupPolicyTypeTypesAndGenerateWmiObjectsForPolicyType(ExceptionTypeData exceptionType,
                                                                                        ExceptionPolicyData parentPolicy,
                                                                                        bool readGroupPolicies, IRegistryKey machineKey, IRegistryKey userKey,
                                                                                        bool generateWmiObjects, ICollection <ConfigurationSetting> wmiSettings)
        {
            if (readGroupPolicies)
            {
                IRegistryKey policyKey = machineKey != null ? machineKey : userKey;
                if (policyKey != null)
                {
                    if (policyKey.IsPolicyKey && !policyKey.GetBoolValue(PolicyValueName).Value)
                    {
                        return(false);
                    }
                    try
                    {
                        PostHandlingAction?postHandlingActionOverride
                            = policyKey.GetEnumValue <PostHandlingAction>(PolicyTypePostHandlingActionPropertyName);

                        exceptionType.PostHandlingAction = postHandlingActionOverride.Value;
                    }
                    catch (RegistryAccessException ex)
                    {
                        LogExceptionWhileOverriding(ex);
                    }
                }
            }
            if (generateWmiObjects)
            {
                ExceptionHandlingSettingsWmiMapper.GenerateExceptionTypeWmiObjects(exceptionType, parentPolicy, wmiSettings);
            }

            // Note: store the handler settings to a temporary location to enable
            // post processing. This forces the creation of a specific interface and
            // fixes the schema.
            List <ConfigurationSetting> handlerSettings = new List <ConfigurationSetting>(exceptionType.ExceptionHandlers.Count);

            OverrideWithGroupPoliciesAndGenerateWmiObjectsForElementCollection(exceptionType.ExceptionHandlers,
                                                                               PolicyTypeHandlersPropertyName,
                                                                               readGroupPolicies, machineKey, userKey,
                                                                               generateWmiObjects, handlerSettings);

            int i = 0;

            foreach (ExceptionHandlerSetting setting in handlerSettings)
            {
                setting.Policy        = parentPolicy.Name;
                setting.ExceptionType = exceptionType.Name;
                setting.Order         = i++;

                // add the post-processed handler settings to the main settings collection
                wmiSettings.Add(setting);
            }

            return(true);
        }
Ejemplo n.º 12
0
        protected override void OverrideWithGroupPolicies(SymmetricAlgorithmProviderData configurationObject, IRegistryKey policyKey)
        {
            String protectedKeyFilenameOverride = policyKey.GetStringValue(ProtectedKeyFilenamePropertyName);
            DataProtectionScope?protectedKeyProtectionScopeOverride
                = policyKey.GetEnumValue <DataProtectionScope>(ProtectedKeyProtectionScopePropertyName);

            // algorithm type is read only in the configuration tool

            configurationObject.ProtectedKeyFilename        = protectedKeyFilenameOverride;
            configurationObject.ProtectedKeyProtectionScope = protectedKeyProtectionScopeOverride.Value;
        }
Ejemplo n.º 13
0
        protected override void OverrideWithGroupPolicies(RollOnceTraceListenerData configObj,
                                                          IRegistryKey policyKey)
        {
            string filenameOverride = policyKey.GetStringValue(FilenamePropertyName);
            string headerOverride   = policyKey.GetStringValue(HeaderPropertyName);
            string footerOverride   = policyKey.GetStringValue(FooterPropertyName);
            int?   maxLogs          = policyKey.GetIntValue(MaxLogsPropertyName);

            string       formatterOverride   = GetFormatterPolicyOverride(policyKey);
            TraceOptions?traceOutputOptionsO = policyKey.GetEnumValue <TraceOptions>(TraceOutputOptionsPropertyName);
            SourceLevels?filterOverride      = policyKey.GetEnumValue <SourceLevels>(FilterPropertyName);

            configObj.FileName           = filenameOverride;
            configObj.Header             = headerOverride;
            configObj.Footer             = footerOverride;
            configObj.Formatter          = formatterOverride;
            configObj.MaxLogs            = maxLogs.Value;
            configObj.TraceOutputOptions = traceOutputOptionsO.Value;
            configObj.Filter             = filterOverride.Value;
        }
Ejemplo n.º 14
0
        protected override void OverrideWithGroupPolicies(EmailTraceListenerData configurationObject, IRegistryKey policyKey)
		{
			String formatterOverride = GetFormatterPolicyOverride(policyKey);
			String fromAddressOverride = policyKey.GetStringValue(FromAddressPropertyName);
			int? smtpPortOverride = policyKey.GetIntValue(SmtpPortPropertyName);
			String smtpServerOverride = policyKey.GetStringValue(SmtpServerPropertyName);
			String subjectLineEnderOverride = policyKey.GetStringValue(SubjectLineEnderPropertyName);
			String subjectLineStarterOverride = policyKey.GetStringValue(SubjectLineStarterPropertyName);
			String toAddressOverride = policyKey.GetStringValue(ToAddressPropertyName);
			TraceOptions? traceOutputOptionsOverride = policyKey.GetEnumValue<TraceOptions>(TraceOutputOptionsPropertyName);
			SourceLevels? filterOverride = policyKey.GetEnumValue<SourceLevels>(FilterPropertyName);
			configurationObject.Formatter = formatterOverride;
			configurationObject.FromAddress = fromAddressOverride;
			configurationObject.SmtpPort = smtpPortOverride.Value;
			configurationObject.SmtpServer = smtpServerOverride;
			configurationObject.SubjectLineEnder = subjectLineEnderOverride;
			configurationObject.SubjectLineStarter = subjectLineStarterOverride;
			configurationObject.ToAddress = toAddressOverride;
			configurationObject.TraceOutputOptions = traceOutputOptionsOverride.Value;
			configurationObject.Filter = filterOverride.Value;
		}
        protected override void OverrideWithGroupPolicies(FormattedDatabaseTraceListenerData configurationObject, IRegistryKey policyKey)
        {
            String       addCategoryStoredProcNameOverride = policyKey.GetStringValue(AddCategoryStoredProcNamePropertyName);
            String       databaseInstanceNameOverride      = policyKey.GetStringValue(DatabaseInstanceNamePropertyName);
            String       formatterOverride              = GetFormatterPolicyOverride(policyKey);
            TraceOptions?traceOutputOptionsOverride     = policyKey.GetEnumValue <TraceOptions>(TraceOutputOptionsPropertyName);
            String       writeLogStoredProcNameOverride = policyKey.GetStringValue(WriteLogStoredProcNamePropertyName);

            configurationObject.AddCategoryStoredProcName = addCategoryStoredProcNameOverride;
            configurationObject.DatabaseInstanceName      = databaseInstanceNameOverride;
            configurationObject.Formatter              = formatterOverride;
            configurationObject.TraceOutputOptions     = traceOutputOptionsOverride.Value;
            configurationObject.WriteLogStoredProcName = writeLogStoredProcNameOverride;
        }
        /// <summary>
        /// Overrides the <paramref name="configurationObject"/>'s properties with the Group Policy values from the
        /// registry.
        /// </summary>
        /// <param name="configurationObject">The configuration object for instances that must be managed.</param>
        /// <param name="policyKey">The <see cref="IRegistryKey"/> which holds the Group Policy overrides for the
        /// configuration element.</param>
        /// <remarks>Subclasses implementing this method must retrieve all the override values from the registry
        /// before making modifications to the <paramref name="configurationObject"/> so any error retrieving
        /// the override values will cancel policy processing.</remarks>
        protected override void OverrideWithGroupPolicies(LoggingExceptionHandlerData configurationObject, IRegistryKey policyKey)
        {
            int?           eventIdOverride       = policyKey.GetIntValue(EventIdPropertyName);
            Type           formatterTypeOverride = policyKey.GetTypeValue(FormatterTypePropertyName);
            String         logCategoryOverride   = policyKey.GetStringValue(LogCategoryPropertyName);
            int?           priorityOverride      = policyKey.GetIntValue(PriorityPropertyName);
            TraceEventType?severityOverride      = policyKey.GetEnumValue <TraceEventType>(SeverityPropertyName);
            String         titleOverride         = policyKey.GetStringValue(TitlePropertyName);

            configurationObject.EventId       = eventIdOverride.Value;
            configurationObject.FormatterType = formatterTypeOverride;
            configurationObject.LogCategory   = logCategoryOverride;
            configurationObject.Priority      = priorityOverride.Value;
            configurationObject.Severity      = severityOverride.Value;
            configurationObject.Title         = titleOverride;
        }
        protected override void OverrideWithGroupPolicies(CategoryFilterData configurationObject, IRegistryKey policyKey)
        {
            CategoryFilterMode?categoryFilterModelOverride = policyKey.GetEnumValue <CategoryFilterMode>(CategoryFilterModePropertyName);

            configurationObject.CategoryFilters.Clear();
            using (IRegistryKey categoryFiltersOverrideKey = policyKey.OpenSubKey(CategoryFiltersKeyName))
            {
                if (categoryFiltersOverrideKey != null)
                {
                    foreach (String valueName in categoryFiltersOverrideKey.GetValueNames())
                    {
                        configurationObject.CategoryFilters.Add(new CategoryFilterEntry(valueName));
                    }
                }
            }
            configurationObject.CategoryFilterMode = categoryFilterModelOverride.Value;
        }
        private bool OverrideWithGroupPoliciesForTraceSource(
            TraceSourceData traceSourceData,
            bool readGroupPolicies,
            IRegistryKey machineKey,
            IRegistryKey userKey,
            String sourceKind)
        {
            if (readGroupPolicies)
            {
                IRegistryKey policyKey = machineKey != null ? machineKey : userKey;
                if (policyKey != null)
                {
                    if (policyKey.IsPolicyKey && !policyKey.GetBoolValue(PolicyValueName).Value)
                    {
                        return(false);
                    }
                    try
                    {
                        SourceLevels?defaultLevelOverride = policyKey.GetEnumValue <SourceLevels>(SourceDefaultLevelPropertyName);
                        bool?        autoFlushOverride    = policyKey.GetBoolValue(SourceAutoFlushPropertyName);

                        // the key where the values for the source listeners are stored
                        // might not exist if no listener is selected
                        traceSourceData.TraceListeners.Clear();
                        using (IRegistryKey listenersOverrideKey = policyKey.OpenSubKey(SourceTraceListenersPropertyName))
                        {
                            if (listenersOverrideKey != null)
                            {
                                foreach (String valueName in listenersOverrideKey.GetValueNames())
                                {
                                    traceSourceData.TraceListeners.Add(new TraceListenerReferenceData(valueName));
                                }
                            }
                        }
                        traceSourceData.DefaultLevel = defaultLevelOverride.Value;
                        traceSourceData.AutoFlush    = autoFlushOverride.Value;
                    }
                    catch (RegistryAccessException ex)
                    {
                        LogExceptionWhileOverriding(ex);
                    }
                }
            }

            return(true);
        }
        private bool OverrideWithGroupPolicyTypeTypesForPolicyType(ExceptionTypeData exceptionType,
                                                                   ExceptionPolicyData parentPolicy,
                                                                   bool readGroupPolicies, IRegistryKey machineKey, IRegistryKey userKey)
        {
            if (readGroupPolicies)
            {
                IRegistryKey policyKey = machineKey != null ? machineKey : userKey;
                if (policyKey != null)
                {
                    if (policyKey.IsPolicyKey && !policyKey.GetBoolValue(PolicyValueName).Value)
                    {
                        return(false);
                    }
                    try
                    {
                        PostHandlingAction?postHandlingActionOverride
                            = policyKey.GetEnumValue <PostHandlingAction>(PolicyTypePostHandlingActionPropertyName);

                        exceptionType.PostHandlingAction = postHandlingActionOverride.Value;
                    }
                    catch (RegistryAccessException ex)
                    {
                        LogExceptionWhileOverriding(ex);
                    }
                }
            }

            // Note: store the handler settings to a temporary location to enable
            // post processing. This forces the creation of a specific interface and
            // fixes the schema.
            OverrideWithGroupPoliciesForElementCollection(exceptionType.ExceptionHandlers,
                                                          PolicyTypeHandlersPropertyName,
                                                          readGroupPolicies, machineKey, userKey);

            return(true);
        }