Code:
/ 4.0 / 4.0 / 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. // ==++== // // 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
- RawKeyboardInputReport.cs
- OnOperation.cs
- OneOfConst.cs
- LocalizabilityAttribute.cs
- ReferencedType.cs
- WindowsGraphicsCacheManager.cs
- TextElementCollectionHelper.cs
- TypeSystem.cs
- StateManagedCollection.cs
- SecurityPolicySection.cs
- NonVisualControlAttribute.cs
- CredentialSelector.cs
- UnsafeCollabNativeMethods.cs
- StaticFileHandler.cs
- LocatorPart.cs
- RelationshipDetailsCollection.cs
- MetadataCacheItem.cs
- DiagnosticTraceRecords.cs
- SqlAliaser.cs
- TransactedBatchingBehavior.cs
- CompilerCollection.cs
- ErrorInfoXmlDocument.cs
- DataGridViewCheckBoxCell.cs
- MachineKeyValidationConverter.cs
- COM2PictureConverter.cs
- WmlControlAdapter.cs
- WebPartUserCapability.cs
- SpecialTypeDataContract.cs
- EmbeddedMailObject.cs
- ActivityStatusChangeEventArgs.cs
- DeferredReference.cs
- Directory.cs
- XmlSequenceWriter.cs
- DefaultCommandConverter.cs
- SiteOfOriginPart.cs
- SiteMapPath.cs
- IsolatedStorageFilePermission.cs
- AuthenticationModuleElement.cs
- LineGeometry.cs
- CompositeControl.cs
- FacetValues.cs
- KeyGestureValueSerializer.cs
- TextEditorTyping.cs
- ColumnResizeAdorner.cs
- CodeAttributeArgumentCollection.cs
- OutputScopeManager.cs
- XmlBoundElement.cs
- ListViewDeletedEventArgs.cs
- ConfigXmlAttribute.cs
- LicenseException.cs
- ExpandSegment.cs
- XmlTypeAttribute.cs
- StorageEntityContainerMapping.cs
- Misc.cs
- PreApplicationStartMethodAttribute.cs
- RegisteredDisposeScript.cs
- MenuTracker.cs
- Rect3DValueSerializer.cs
- httpstaticobjectscollection.cs
- DrawingVisualDrawingContext.cs
- TextParaClient.cs
- SimpleHandlerBuildProvider.cs
- EvidenceBase.cs
- ComplexTypeEmitter.cs
- FastEncoderWindow.cs
- XmlNamespaceManager.cs
- CompositeControl.cs
- IdlingCommunicationPool.cs
- WebZone.cs
- AttachedPropertyBrowsableAttribute.cs
- SchemaTypeEmitter.cs
- Animatable.cs
- ReachDocumentReferenceSerializerAsync.cs
- ResourceDescriptionAttribute.cs
- ResourceCategoryAttribute.cs
- TextEditorCopyPaste.cs
- SecurityManager.cs
- WindowsRichEditRange.cs
- InfiniteTimeSpanConverter.cs
- CommandField.cs
- MimeTypeMapper.cs
- ExceptionValidationRule.cs
- CheckableControlBaseAdapter.cs
- StreamResourceInfo.cs
- UseLicense.cs
- ClassGenerator.cs
- ConfigXmlSignificantWhitespace.cs
- PropertyEmitter.cs
- SqlUserDefinedTypeAttribute.cs
- GlobalItem.cs
- ComponentChangedEvent.cs
- ModelEditingScope.cs
- NoneExcludedImageIndexConverter.cs
- ReadOnlyPropertyMetadata.cs
- SecurityPolicySection.cs
- MultiTrigger.cs
- Int32Storage.cs
- ButtonChrome.cs
- XmlJsonWriter.cs
- PerfProviderCollection.cs