Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Diagnostics / Eventing / Reader / EventLogHandle.cs / 1305376 / EventLogHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventLogHandle ** ** Purpose: ** This internal class is a SafeHandle implementation over a ** native EVT_HANDLE - obtained from EventLog Native Methods. ** ============================================================*/ using System; using System.Runtime.InteropServices; using System.Security.Permissions; namespace System.Diagnostics.Eventing.Reader { // // Marked as SecurityCritical due to link demands from inherited // SafeHandle members. // // marked as Safe since the only real operation that is performed // by this class is NativeWrapper.EvtClose and that is protected // by a full Demand() before doing any work. [System.Security.SecuritySafeCritical] internal sealed class EventLogHandle : SafeHandle { // Called by P/Invoke when returning SafeHandles private EventLogHandle() : base(IntPtr.Zero, true) { } internal EventLogHandle(IntPtr handle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) { SetHandle(handle); } public override bool IsInvalid { get { return IsClosed || handle == IntPtr.Zero; } } protected override bool ReleaseHandle() { NativeWrapper.EvtClose(handle); handle = IntPtr.Zero; return true; } // DONT compare EventLogHandle with EventLogHandle.Zero // use IsInvalid instead. Zero is provided where a NULL handle needed public static EventLogHandle Zero { get { return new EventLogHandle(); } } } } // 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
- BuildManager.cs
- EventToken.cs
- DnsCache.cs
- InvokeProviderWrapper.cs
- DataControlButton.cs
- DrawToolTipEventArgs.cs
- FolderNameEditor.cs
- EventHandlers.cs
- ValueUtilsSmi.cs
- NodeInfo.cs
- Sql8ExpressionRewriter.cs
- ScrollBarRenderer.cs
- XmlSortKey.cs
- BitmapFrameEncode.cs
- DispatchWrapper.cs
- IisTraceListener.cs
- WorkflowPageSetupDialog.cs
- DesignTimeHTMLTextWriter.cs
- Trace.cs
- Permission.cs
- ImportCatalogPart.cs
- XamlStackWriter.cs
- OdbcConnection.cs
- figurelengthconverter.cs
- ResourceAttributes.cs
- HierarchicalDataBoundControl.cs
- MethodCallTranslator.cs
- CodeNamespace.cs
- CacheChildrenQuery.cs
- VectorAnimationUsingKeyFrames.cs
- XmlSchemaInfo.cs
- CompilerResults.cs
- FileLogRecordEnumerator.cs
- ListDictionary.cs
- HttpApplicationFactory.cs
- DataRowView.cs
- SHA512.cs
- XmlSchemaImporter.cs
- ToolStripSettings.cs
- HandleCollector.cs
- TaskFactory.cs
- CodeSubDirectory.cs
- KnownTypes.cs
- ViewManagerAttribute.cs
- DurationConverter.cs
- SerializationStore.cs
- WindowsAltTab.cs
- HttpWrapper.cs
- CacheEntry.cs
- WebSysDisplayNameAttribute.cs
- MainMenu.cs
- AssemblyResourceLoader.cs
- UIElement3DAutomationPeer.cs
- ControlIdConverter.cs
- SystemIdentity.cs
- BamlCollectionHolder.cs
- CommandSet.cs
- SqlParameter.cs
- PropertyChangedEventArgs.cs
- WebPartManagerInternals.cs
- AliasedExpr.cs
- CuspData.cs
- PopOutPanel.cs
- DesignBindingPropertyDescriptor.cs
- ViewEvent.cs
- __ConsoleStream.cs
- RepeatBehaviorConverter.cs
- TextLineBreak.cs
- DataGridColumn.cs
- PageCodeDomTreeGenerator.cs
- Decoder.cs
- QilParameter.cs
- IdentityManager.cs
- MaterialGroup.cs
- AgileSafeNativeMemoryHandle.cs
- BodyWriter.cs
- ProgressPage.cs
- HierarchicalDataTemplate.cs
- recordstatescratchpad.cs
- UIElementParaClient.cs
- ReferentialConstraint.cs
- KeyedHashAlgorithm.cs
- LoginDesignerUtil.cs
- DescendantOverDescendantQuery.cs
- StateDesigner.LayoutSelectionGlyph.cs
- CreateUserWizard.cs
- MDIControlStrip.cs
- BitmapInitialize.cs
- EUCJPEncoding.cs
- Attributes.cs
- GlyphRun.cs
- dsa.cs
- FormsAuthenticationCredentials.cs
- Qualifier.cs
- ValidatorCompatibilityHelper.cs
- HtmlControlDesigner.cs
- PagedDataSource.cs
- XmlSchemaSubstitutionGroup.cs
- ListBindingHelper.cs
- _SecureChannel.cs