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
- DynamicDataExtensions.cs
- SHA384Managed.cs
- AnnotationResource.cs
- SubstitutionList.cs
- oledbmetadatacollectionnames.cs
- IQueryable.cs
- GridViewRowPresenter.cs
- ListBindableAttribute.cs
- XmlCharacterData.cs
- EntitySqlQueryBuilder.cs
- SettingsPropertyWrongTypeException.cs
- PeerName.cs
- XmlEncodedRawTextWriter.cs
- CalendarDay.cs
- ScrollBarRenderer.cs
- TraceSection.cs
- TdsParser.cs
- CqlQuery.cs
- XPathQueryGenerator.cs
- ZeroOpNode.cs
- Metafile.cs
- TableAutomationPeer.cs
- ConfigurationElementCollection.cs
- SuppressMessageAttribute.cs
- DebugHandleTracker.cs
- VoiceChangeEventArgs.cs
- SignatureHelper.cs
- NameNode.cs
- CompModSwitches.cs
- PngBitmapEncoder.cs
- GeneratedContractType.cs
- Source.cs
- ExtendedPropertyCollection.cs
- M3DUtil.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- Wrapper.cs
- EllipseGeometry.cs
- ResourcePermissionBase.cs
- CompoundFileStorageReference.cs
- XmlSchemaInfo.cs
- UnderstoodHeaders.cs
- AlignmentXValidation.cs
- ProtocolsConfigurationHandler.cs
- ProcessModelSection.cs
- OleDbStruct.cs
- MainMenu.cs
- BitmapEncoder.cs
- XPathNavigator.cs
- EventInfo.cs
- BrowserCapabilitiesCodeGenerator.cs
- UIElement3DAutomationPeer.cs
- DiscoveryDocumentLinksPattern.cs
- KnownAssemblyEntry.cs
- MetadataSerializer.cs
- DispatcherObject.cs
- ConfigurationElementCollection.cs
- httpserverutility.cs
- Int32CAMarshaler.cs
- BidOverLoads.cs
- MembershipAdapter.cs
- DigitalSignatureProvider.cs
- XmlExpressionDumper.cs
- AssemblyHelper.cs
- StsCommunicationException.cs
- DetailsViewRowCollection.cs
- SeekStoryboard.cs
- FileLevelControlBuilderAttribute.cs
- ObjectSpanRewriter.cs
- StaticExtensionConverter.cs
- DbConnectionFactory.cs
- FocusManager.cs
- EdmError.cs
- IriParsingElement.cs
- DataGridCellsPanel.cs
- HMAC.cs
- Array.cs
- Rect3D.cs
- UdpSocket.cs
- ScrollChangedEventArgs.cs
- COM2IDispatchConverter.cs
- SchemaConstraints.cs
- ApplicationCommands.cs
- ImageDrawing.cs
- SynchronizedInputAdaptor.cs
- ValidateNames.cs
- ListSortDescription.cs
- QilPatternVisitor.cs
- WindowsTooltip.cs
- TransactionInterop.cs
- LineBreak.cs
- ConstantProjectedSlot.cs
- ColorConvertedBitmap.cs
- CssStyleCollection.cs
- TagPrefixInfo.cs
- Point3DAnimation.cs
- JournalEntryListConverter.cs
- ObjectCacheSettings.cs
- CompiledXpathExpr.cs
- ConfigXmlComment.cs
- RequestCache.cs