Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Diagnostics / Eventing / Reader / EventLogPropertySelector.cs / 1305376 / EventLogPropertySelector.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventLogPropertySelector ** ** Purpose: ** Public class that encapsulates the information for fast ** access to Event Values of an EventLogRecord. Implements ** the EventPropertyContext abstract class. An instance of this ** class is constructed and then passed to ** EventLogRecord.GetEventPropertyValues. ** ============================================================*/ using System; using System.Collections.Generic; using Microsoft.Win32; namespace System.Diagnostics.Eventing.Reader { ////// Encapsulates the information for fast access to Event Values /// of an EventLogRecord. An instance of this class is constructed /// and then passed to EventLogRecord.GetEventPropertyValues. /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public class EventLogPropertySelector : IDisposable { // // access to the data member reference is safe, while // invoking methods on it is marked SecurityCritical as appropriate. // private EventLogHandle renderContextHandleValues; [System.Security.SecurityCritical] public EventLogPropertySelector(IEnumerablepropertyQueries) { EventLogPermissionHolder.GetEventLogPermission().Demand(); if (propertyQueries == null) throw new ArgumentNullException("propertyQueries"); string[] paths; ICollection coll = propertyQueries as ICollection ; if (coll != null) { paths = new string[coll.Count]; coll.CopyTo(paths, 0); } else { List queries; queries = new List (propertyQueries); paths = queries.ToArray(); } renderContextHandleValues = NativeWrapper.EvtCreateRenderContext(paths.Length, paths, UnsafeNativeMethods.EvtRenderContextFlags.EvtRenderContextValues); } internal EventLogHandle Handle { // just returning reference to security critical type, the methods // of that type are protected by SecurityCritical as appropriate. get { return renderContextHandleValues; } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } [System.Security.SecuritySafeCritical] protected virtual void Dispose(bool disposing) { if (disposing) { EventLogPermissionHolder.GetEventLogPermission().Demand(); } if (renderContextHandleValues != null && !renderContextHandleValues.IsInvalid) renderContextHandleValues.Dispose(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventLogPropertySelector ** ** Purpose: ** Public class that encapsulates the information for fast ** access to Event Values of an EventLogRecord. Implements ** the EventPropertyContext abstract class. An instance of this ** class is constructed and then passed to ** EventLogRecord.GetEventPropertyValues. ** ============================================================*/ using System; using System.Collections.Generic; using Microsoft.Win32; namespace System.Diagnostics.Eventing.Reader { /// /// Encapsulates the information for fast access to Event Values /// of an EventLogRecord. An instance of this class is constructed /// and then passed to EventLogRecord.GetEventPropertyValues. /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public class EventLogPropertySelector : IDisposable { // // access to the data member reference is safe, while // invoking methods on it is marked SecurityCritical as appropriate. // private EventLogHandle renderContextHandleValues; [System.Security.SecurityCritical] public EventLogPropertySelector(IEnumerablepropertyQueries) { EventLogPermissionHolder.GetEventLogPermission().Demand(); if (propertyQueries == null) throw new ArgumentNullException("propertyQueries"); string[] paths; ICollection coll = propertyQueries as ICollection ; if (coll != null) { paths = new string[coll.Count]; coll.CopyTo(paths, 0); } else { List queries; queries = new List (propertyQueries); paths = queries.ToArray(); } renderContextHandleValues = NativeWrapper.EvtCreateRenderContext(paths.Length, paths, UnsafeNativeMethods.EvtRenderContextFlags.EvtRenderContextValues); } internal EventLogHandle Handle { // just returning reference to security critical type, the methods // of that type are protected by SecurityCritical as appropriate. get { return renderContextHandleValues; } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } [System.Security.SecuritySafeCritical] protected virtual void Dispose(bool disposing) { if (disposing) { EventLogPermissionHolder.GetEventLogPermission().Demand(); } if (renderContextHandleValues != null && !renderContextHandleValues.IsInvalid) renderContextHandleValues.Dispose(); } } } // 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
- CalendarModeChangedEventArgs.cs
- XmlEncApr2001.cs
- DefaultProfileManager.cs
- TabControlAutomationPeer.cs
- EntityDataSourceWizardForm.cs
- ImageMapEventArgs.cs
- PageCopyCount.cs
- DuplicateWaitObjectException.cs
- GridViewDesigner.cs
- ResourceAssociationTypeEnd.cs
- Int64Animation.cs
- SchemaMerger.cs
- StandardMenuStripVerb.cs
- BasicExpandProvider.cs
- RuntimeCompatibilityAttribute.cs
- GeneratedContractType.cs
- Operand.cs
- ListView.cs
- CodeSnippetExpression.cs
- QilPatternVisitor.cs
- PrintPreviewControl.cs
- MetadataUtilsSmi.cs
- WithParamAction.cs
- DependencyPropertyChangedEventArgs.cs
- Attributes.cs
- _Events.cs
- PropertyValueUIItem.cs
- storepermission.cs
- WebPermission.cs
- SchemaContext.cs
- PathSegment.cs
- IChannel.cs
- CqlQuery.cs
- FileRecordSequenceHelper.cs
- Vector.cs
- AssemblyUtil.cs
- PaperSize.cs
- ExceptionHandlerDesigner.cs
- TabControl.cs
- ServicePointManagerElement.cs
- WebPartConnectionsCloseVerb.cs
- BitmapEffectOutputConnector.cs
- HuffmanTree.cs
- keycontainerpermission.cs
- HtmlElementCollection.cs
- ErrorFormatterPage.cs
- TextContainerHelper.cs
- ConnectionConsumerAttribute.cs
- Visual3D.cs
- Pen.cs
- IgnoreSectionHandler.cs
- CredentialCache.cs
- ThrowHelper.cs
- OdbcUtils.cs
- OciHandle.cs
- XPathParser.cs
- RegisteredExpandoAttribute.cs
- RoleGroupCollection.cs
- XmlDataProvider.cs
- XamlGridLengthSerializer.cs
- DatePickerTextBox.cs
- KeySplineConverter.cs
- BinarySerializer.cs
- DataListComponentEditor.cs
- GridLengthConverter.cs
- DataGridViewComboBoxColumnDesigner.cs
- PropertyMetadata.cs
- JumpTask.cs
- LineGeometry.cs
- DataGridViewCellCancelEventArgs.cs
- XpsS0ValidatingLoader.cs
- DbConnectionFactory.cs
- WorkflowQueue.cs
- CreateUserWizardDesigner.cs
- CopyAttributesAction.cs
- PartialCachingAttribute.cs
- SystemWebSectionGroup.cs
- Style.cs
- TextEditorTables.cs
- UnsafeNativeMethods.cs
- SmtpNetworkElement.cs
- IndentTextWriter.cs
- ResourceReferenceExpression.cs
- ValueHandle.cs
- GenericAuthenticationEventArgs.cs
- SafePEFileHandle.cs
- SessionStateUtil.cs
- XmlAttributeHolder.cs
- HashLookup.cs
- ExpandCollapsePattern.cs
- AtomPub10CategoriesDocumentFormatter.cs
- ResourcesChangeInfo.cs
- KernelTypeValidation.cs
- SortedList.cs
- ImageListDesigner.cs
- StorageComplexPropertyMapping.cs
- SimpleHandlerFactory.cs
- FlowDocumentView.cs
- XmlSerializerImportOptions.cs
- ByteStream.cs