Ejemplo n.º 1
0
        // Token: 0x06000491 RID: 1169 RVA: 0x0001A37C File Offset: 0x0001857C
        private void Initialize(ExDateTime serviceStartTime, string logFilePath, TimeSpan maxRetentionPeriod, ByteQuantifiedSize directorySizeQuota, ByteQuantifiedSize perFileSizeQuota, bool applyHourPrecision)
        {
            int registryInt;

            using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess\\Parameters"))
            {
                this.enabled = ADProtocolLog.GetRegistryBool(registryKey, "ProtocolLoggingEnabled", true);
                registryInt  = ADProtocolLog.GetRegistryInt(registryKey, "LogBufferSize", 524288);
                int registryInt2 = ADProtocolLog.GetRegistryInt(registryKey, "FlushIntervalInMinutes", 15);
                if (registryInt2 > 0)
                {
                    ADProtocolLog.FlushInterval = TimeSpan.FromMinutes((double)registryInt2);
                }
            }
            if (this.registryWatcher == null)
            {
                this.registryWatcher = new RegistryWatcher("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess\\Parameters", false);
            }
            if (this.timer == null)
            {
                this.timer = new Timer(new TimerCallback(this.UpdateConfigIfChanged), null, 0, 300000);
            }
            if (this.enabled)
            {
                this.log = new Log(ADProtocolLog.LogFilePrefix, new LogHeaderFormatter(ADProtocolLog.Schema, LogHeaderCsvOption.CsvCompatible), "ADDriverLogs");
                this.log.Configure(logFilePath, maxRetentionPeriod, (long)directorySizeQuota.ToBytes(), (long)perFileSizeQuota.ToBytes(), applyHourPrecision, registryInt, ADProtocolLog.FlushInterval, LogFileRollOver.Hourly);
                AppDomain.CurrentDomain.ProcessExit += this.CurrentDomain_ProcessExit;
            }
            this.initialized = true;
        }
Ejemplo n.º 2
0
 // Token: 0x0600048B RID: 1163 RVA: 0x0001A060 File Offset: 0x00018260
 internal void Append(string operation, string dn, string filter, string scope, string dc, string port, string resultCode, long processingTime, string failure, int serverProcessingTime, int entriesVisted, int entriesReturned, Guid activityId, string userEmail, string newValue, string callerInfo)
 {
     if (!this.initialized)
     {
         lock (this.logLock)
         {
             if (!this.initialized)
             {
                 this.Initialize(ExDateTime.UtcNow, Path.Combine(ADProtocolLog.GetExchangeInstallPath(), "Logging\\ADDriver\\"), ADProtocolLog.DefaultMaxRetentionPeriod, ADProtocolLog.DefaultDirectorySizeQuota, ADProtocolLog.DefaultPerFileSizeQuota, true);
             }
         }
     }
     if (this.enabled)
     {
         LogRowFormatter logRowFormatter = new LogRowFormatter(ADProtocolLog.Schema);
         logRowFormatter[1]  = this.GetNextSequenceNumber();
         logRowFormatter[2]  = Globals.ProcessName;
         logRowFormatter[4]  = Globals.ProcessAppName;
         logRowFormatter[3]  = Globals.ProcessId;
         logRowFormatter[5]  = operation;
         logRowFormatter[7]  = processingTime;
         logRowFormatter[8]  = serverProcessingTime;
         logRowFormatter[10] = entriesReturned;
         logRowFormatter[9]  = entriesVisted;
         logRowFormatter[11] = dn;
         logRowFormatter[12] = filter;
         logRowFormatter[13] = scope;
         logRowFormatter[15] = dc;
         logRowFormatter[16] = port;
         logRowFormatter[6]  = resultCode;
         logRowFormatter[14] = failure;
         logRowFormatter[17] = activityId;
         logRowFormatter[20] = callerInfo;
         logRowFormatter[19] = newValue;
         logRowFormatter[18] = userEmail;
         lock (this.logLock)
         {
             this.rows.Add(logRowFormatter);
             if (this.flush == null)
             {
                 this.flush = new ADProtocolLog.FlushDelegate(this.FlushRows);
                 this.flush.BeginInvoke(null, null);
             }
         }
     }
 }
Ejemplo n.º 3
0
 // Token: 0x06000492 RID: 1170 RVA: 0x0001A4A0 File Offset: 0x000186A0
 private void UpdateConfigIfChanged(object state)
 {
     if (this.registryWatcher.IsChanged())
     {
         using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess\\Parameters"))
         {
             bool registryBool = ADProtocolLog.GetRegistryBool(registryKey, "ProtocolLoggingEnabled", true);
             if (registryBool != this.enabled)
             {
                 lock (this.logLock)
                 {
                     this.initialized = false;
                     this.enabled     = registryBool;
                 }
             }
         }
     }
 }