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
- UIPermission.cs
- ComponentChangingEvent.cs
- FtpWebResponse.cs
- TemporaryBitmapFile.cs
- ZoneMembershipCondition.cs
- QueryResults.cs
- AdCreatedEventArgs.cs
- GridItem.cs
- ChooseAction.cs
- XmlBindingWorker.cs
- NotifyIcon.cs
- DataGridViewCellValueEventArgs.cs
- MessageQueueEnumerator.cs
- dataobject.cs
- NameValueConfigurationElement.cs
- FaultCallbackWrapper.cs
- CommonXSendMessage.cs
- QilExpression.cs
- TypeConverterHelper.cs
- ObjectListSelectEventArgs.cs
- ValidationError.cs
- BookmarkWorkItem.cs
- ImageAnimator.cs
- SystemBrushes.cs
- DrawingCollection.cs
- WebContext.cs
- XmlNodeList.cs
- AsyncContentLoadedEventArgs.cs
- EntryPointNotFoundException.cs
- StringStorage.cs
- DecoratedNameAttribute.cs
- WindowsRebar.cs
- QilTypeChecker.cs
- SqlDataSourceFilteringEventArgs.cs
- UpdatePanelControlTrigger.cs
- MultiView.cs
- WorkflowQueueInfo.cs
- WebResponse.cs
- MaskedTextProvider.cs
- PropertyDescriptorCollection.cs
- ImageListImage.cs
- OleDbSchemaGuid.cs
- CodePageEncoding.cs
- CompositeDesignerAccessibleObject.cs
- CodeDOMUtility.cs
- CodeIdentifiers.cs
- GiveFeedbackEventArgs.cs
- IndicFontClient.cs
- FileSystemInfo.cs
- ShimAsPublicXamlType.cs
- ProtectedConfigurationSection.cs
- BoundColumn.cs
- Math.cs
- OracleSqlParser.cs
- CompensationParticipant.cs
- DtdParser.cs
- StringInfo.cs
- ElementUtil.cs
- IsolationInterop.cs
- PublishLicense.cs
- ClusterSafeNativeMethods.cs
- EmptyControlCollection.cs
- CodeDomDesignerLoader.cs
- ObjectAssociationEndMapping.cs
- ObjectViewQueryResultData.cs
- ProgressPage.cs
- CompositeScriptReferenceEventArgs.cs
- ConfigXmlText.cs
- CatalogPart.cs
- OLEDB_Enum.cs
- SelectionRangeConverter.cs
- CacheMemory.cs
- ArcSegment.cs
- XmlILIndex.cs
- CreatingCookieEventArgs.cs
- EventHandlerList.cs
- ObjectStorage.cs
- parserscommon.cs
- TiffBitmapEncoder.cs
- XamlGridLengthSerializer.cs
- ListBindingConverter.cs
- Console.cs
- LayoutTable.cs
- MouseButton.cs
- ClaimSet.cs
- BufferManager.cs
- PhysicalFontFamily.cs
- SqlConnectionPoolProviderInfo.cs
- GroupBoxDesigner.cs
- UpDownBaseDesigner.cs
- SerializationFieldInfo.cs
- OleDbInfoMessageEvent.cs
- Table.cs
- DynamicResourceExtension.cs
- ManipulationDelta.cs
- SqlProviderServices.cs
- IFlowDocumentViewer.cs
- ValueTable.cs
- ComNativeDescriptor.cs
- Italic.cs