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
- FileDialog.cs
- CanonicalXml.cs
- EntityDataSourceEntityTypeFilterItem.cs
- GroupBoxAutomationPeer.cs
- UrlAuthFailedErrorFormatter.cs
- IntegerValidatorAttribute.cs
- AssemblyBuilderData.cs
- MasterPageCodeDomTreeGenerator.cs
- ConstrainedDataObject.cs
- ProcessStartInfo.cs
- PassportAuthentication.cs
- COAUTHINFO.cs
- ProcessManager.cs
- pingexception.cs
- WebPartHeaderCloseVerb.cs
- FormatSettings.cs
- RectValueSerializer.cs
- DNS.cs
- CustomAttributeBuilder.cs
- DataConnectionHelper.cs
- SqlResolver.cs
- Typeface.cs
- Pair.cs
- DataTable.cs
- ConversionValidationRule.cs
- DocumentPageTextView.cs
- XmlIlGenerator.cs
- ListenerTraceUtility.cs
- RuleConditionDialog.Designer.cs
- TemplateComponentConnector.cs
- Transform3D.cs
- CacheSection.cs
- XmlCodeExporter.cs
- WmpBitmapDecoder.cs
- UserPreferenceChangedEventArgs.cs
- CharKeyFrameCollection.cs
- HttpGetProtocolReflector.cs
- StyleXamlParser.cs
- DSASignatureFormatter.cs
- XmlSubtreeReader.cs
- SqlTriggerAttribute.cs
- AssociationEndMember.cs
- Code.cs
- DataGridViewAccessibleObject.cs
- SqlAliasesReferenced.cs
- GroupItem.cs
- DllNotFoundException.cs
- TraceContext.cs
- Perspective.cs
- ContractCodeDomInfo.cs
- SimpleApplicationHost.cs
- ContentPresenter.cs
- InheritanceAttribute.cs
- SqlUtil.cs
- Keywords.cs
- ProcessHostServerConfig.cs
- TraceContext.cs
- _LocalDataStoreMgr.cs
- WsiProfilesElement.cs
- EmptyImpersonationContext.cs
- DataGridViewRowsRemovedEventArgs.cs
- SimpleWorkerRequest.cs
- UnsafeNativeMethods.cs
- ObfuscationAttribute.cs
- ProjectionCamera.cs
- AtomPub10ServiceDocumentFormatter.cs
- SqlDataSourceView.cs
- ActivationArguments.cs
- Package.cs
- GenericTypeParameterConverter.cs
- InputProcessorProfilesLoader.cs
- StrongNameIdentityPermission.cs
- EventLogPermissionEntry.cs
- PointCollection.cs
- Tracer.cs
- DeviceContext.cs
- UnsafeNativeMethods.cs
- ConnectionStringsSection.cs
- TransactionManager.cs
- CodeParameterDeclarationExpression.cs
- DescendentsWalkerBase.cs
- TimeEnumHelper.cs
- File.cs
- BrowserPolicyValidator.cs
- MetadataWorkspace.cs
- FormViewDeleteEventArgs.cs
- WebException.cs
- FormParameter.cs
- XmlDataSourceView.cs
- SchemaTableColumn.cs
- PerspectiveCamera.cs
- MaskedTextBoxDesignerActionList.cs
- BamlLocalizableResourceKey.cs
- BrowserCapabilitiesFactory.cs
- XmlTextReader.cs
- CancelEventArgs.cs
- TypedTableBase.cs
- VirtualDirectoryMapping.cs
- ThreadStartException.cs
- EntityDataSourceViewSchema.cs