Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Diagnostics / Eventing / Reader / EventLogInformation.cs / 1305376 / EventLogInformation.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Class: EventLogInformation
**
** Purpose:
** The objects of this class allow access to the run-time
** properties of logs and external log files. An instance of this
** class is obtained from EventLogSession.
**
============================================================*/
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace System.Diagnostics.Eventing.Reader {
///
/// Describes the run-time properties of logs and external log files. An instance
/// of this class is obtained from EventLogSession.
///
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public sealed class EventLogInformation {
DateTime? creationTime;
DateTime? lastAccessTime;
DateTime? lastWriteTime;
long? fileSize;
int? fileAttributes;
long? recordCount;
long? oldestRecordNumber;
bool? isLogFull;
[System.Security.SecuritySafeCritical]
internal EventLogInformation(EventLogSession session, string channelName, PathType pathType) {
EventLogPermissionHolder.GetEventLogPermission().Demand();
EventLogHandle logHandle = NativeWrapper.EvtOpenLog(session.Handle, channelName, pathType);
using (logHandle) {
creationTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogCreationTime);
lastAccessTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogLastAccessTime);
lastWriteTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogLastWriteTime);
fileSize = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogFileSize));
fileAttributes = (int?)((uint?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogAttributes));
recordCount = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogNumberOfLogRecords));
oldestRecordNumber = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogOldestRecordNumber));
isLogFull = (bool?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogFull);
}
}
public DateTime? CreationTime { get { return creationTime; } }
public DateTime? LastAccessTime { get { return lastAccessTime; } }
public DateTime? LastWriteTime { get { return lastWriteTime; } }
public long? FileSize { get { return fileSize; } }
public int? Attributes { get { return fileAttributes; } }
public long? RecordCount { get { return recordCount; } }
public long? OldestRecordNumber { get { return oldestRecordNumber; } }
public bool? IsLogFull { get { return isLogFull; } }
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OdbcReferenceCollection.cs
- NavigationWindow.cs
- SHA384CryptoServiceProvider.cs
- HtmlInputHidden.cs
- DataGridItem.cs
- SiteMapDataSource.cs
- ProviderBase.cs
- GuidelineSet.cs
- FormsAuthentication.cs
- WeakRefEnumerator.cs
- DesignerSerializationManager.cs
- FlowDocumentScrollViewer.cs
- DataGridViewRowStateChangedEventArgs.cs
- LinqDataSourceHelper.cs
- keycontainerpermission.cs
- SqlTriggerAttribute.cs
- SqlHelper.cs
- SaveFileDialogDesigner.cs
- QilInvokeLateBound.cs
- FacetEnabledSchemaElement.cs
- ModifierKeysConverter.cs
- MapPathBasedVirtualPathProvider.cs
- MatrixTransform.cs
- SqlDataReader.cs
- PropertyGridEditorPart.cs
- BamlWriter.cs
- KeysConverter.cs
- SiteMapPath.cs
- Reference.cs
- CacheChildrenQuery.cs
- BamlTreeUpdater.cs
- XNodeNavigator.cs
- SortExpressionBuilder.cs
- WindowsStatusBar.cs
- UserPersonalizationStateInfo.cs
- SolidColorBrush.cs
- DashStyle.cs
- TargetInvocationException.cs
- HTTPNotFoundHandler.cs
- CompileXomlTask.cs
- SplitterEvent.cs
- RtfToken.cs
- Rotation3DKeyFrameCollection.cs
- EntityChangedParams.cs
- XamlBrushSerializer.cs
- DataControlFieldCollection.cs
- Int32Animation.cs
- ParsedAttributeCollection.cs
- TabControlEvent.cs
- WsdlInspector.cs
- FormsAuthenticationUserCollection.cs
- SafeBitVector32.cs
- DesigntimeLicenseContextSerializer.cs
- XamlPathDataSerializer.cs
- HttpChannelHelpers.cs
- COM2AboutBoxPropertyDescriptor.cs
- sqlinternaltransaction.cs
- TagPrefixInfo.cs
- Fonts.cs
- BitmapData.cs
- NonSerializedAttribute.cs
- OdbcCommand.cs
- DiscreteKeyFrames.cs
- FilterException.cs
- CustomErrorsSection.cs
- ValueSerializerAttribute.cs
- MergeFilterQuery.cs
- AssociatedControlConverter.cs
- ObjectSpanRewriter.cs
- WorkflowServiceHostFactory.cs
- XmlSchemaSimpleTypeList.cs
- KeyValueConfigurationElement.cs
- XamlTreeBuilderBamlRecordWriter.cs
- BadImageFormatException.cs
- InvalidAsynchronousStateException.cs
- DataGridViewColumnCollectionEditor.cs
- EdmComplexTypeAttribute.cs
- TreeNodeClickEventArgs.cs
- SmtpReplyReaderFactory.cs
- MarkupCompilePass2.cs
- IndexerReference.cs
- StackBuilderSink.cs
- EncodingTable.cs
- SerialReceived.cs
- ProcessModelSection.cs
- CodeGeneratorOptions.cs
- ListBoxAutomationPeer.cs
- SQLBoolean.cs
- GroupBox.cs
- ControlSerializer.cs
- TraceEventCache.cs
- Helper.cs
- TimelineGroup.cs
- StatusBar.cs
- BitmapEffect.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- CapabilitiesState.cs
- DataPagerFieldItem.cs
- WmlValidatorAdapter.cs
- ThreadTrace.cs