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
- InputProviderSite.cs
- RegistryPermission.cs
- QueryableFilterUserControl.cs
- ListControl.cs
- LoginCancelEventArgs.cs
- FixedSOMPageElement.cs
- MultiTouchSystemGestureLogic.cs
- StatusBarPanelClickEvent.cs
- GridView.cs
- ProxyAttribute.cs
- CompilerGlobalScopeAttribute.cs
- DrawingGroup.cs
- XslTransform.cs
- BinaryUtilClasses.cs
- ReadOnlyCollection.cs
- TextContainerChangeEventArgs.cs
- DataGridViewTopLeftHeaderCell.cs
- ContextMenu.cs
- StrongNameUtility.cs
- SqlIdentifier.cs
- BitmapEffectDrawingContent.cs
- Paragraph.cs
- BounceEase.cs
- IRCollection.cs
- PeerDuplexChannelListener.cs
- XmlWrappingReader.cs
- TextReader.cs
- Font.cs
- GridItem.cs
- SqlXml.cs
- RawMouseInputReport.cs
- CodeConditionStatement.cs
- WebResponse.cs
- PrimarySelectionAdorner.cs
- KeyPullup.cs
- ClientBuildManager.cs
- Filter.cs
- CodeDelegateInvokeExpression.cs
- XamlPoint3DCollectionSerializer.cs
- TextProperties.cs
- XsdCachingReader.cs
- ComplexType.cs
- HelloOperation11AsyncResult.cs
- DriveInfo.cs
- autovalidator.cs
- XamlInt32CollectionSerializer.cs
- WebRequest.cs
- GiveFeedbackEventArgs.cs
- ConvertEvent.cs
- DesignerVerb.cs
- ToolStripSplitStackLayout.cs
- PolicyException.cs
- EpmHelper.cs
- DockAndAnchorLayout.cs
- ValueProviderWrapper.cs
- XmlWriterDelegator.cs
- ListViewContainer.cs
- ReadWriteObjectLock.cs
- XmlSchemaGroup.cs
- FixedHighlight.cs
- RootAction.cs
- DelegateBodyWriter.cs
- ListControlBoundActionList.cs
- Image.cs
- BrowserTree.cs
- MethodCallExpression.cs
- TypeLibConverter.cs
- EncoderParameters.cs
- ArrangedElement.cs
- DeploymentSectionCache.cs
- TagPrefixAttribute.cs
- PeerValidationBehavior.cs
- VerificationAttribute.cs
- PagePropertiesChangingEventArgs.cs
- ping.cs
- UInt64.cs
- RightNameExpirationInfoPair.cs
- AuthorizationSection.cs
- _SslSessionsCache.cs
- ContentType.cs
- AdornerPresentationContext.cs
- NamespaceDecl.cs
- GestureRecognizer.cs
- MD5HashHelper.cs
- TextProperties.cs
- ConditionalExpression.cs
- StickyNoteContentControl.cs
- SqlDataSourceCommandEventArgs.cs
- Wizard.cs
- WebPartConnectionCollection.cs
- MonitoringDescriptionAttribute.cs
- ChtmlPageAdapter.cs
- EdmProperty.cs
- X509WindowsSecurityToken.cs
- WindowsFormsHelpers.cs
- ContractValidationHelper.cs
- SqlRowUpdatedEvent.cs
- HttpInputStream.cs
- Constants.cs
- TextStore.cs