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
- DesignerActionGlyph.cs
- SingleAnimationUsingKeyFrames.cs
- IndexingContentUnit.cs
- StylusEventArgs.cs
- Transform.cs
- PropertyDescriptorComparer.cs
- SecurityPermission.cs
- ClassicBorderDecorator.cs
- CodeSnippetExpression.cs
- WebPartDescriptionCollection.cs
- DataSourceProvider.cs
- DoubleUtil.cs
- ServiceContractAttribute.cs
- XmlObjectSerializerWriteContext.cs
- XmlUnspecifiedAttribute.cs
- XmlSchemaAttribute.cs
- NTAccount.cs
- XmlAnyElementAttributes.cs
- ForceCopyBuildProvider.cs
- CodeTypeReference.cs
- IIS7WorkerRequest.cs
- OLEDB_Util.cs
- WizardStepCollectionEditor.cs
- ListBase.cs
- TimeoutValidationAttribute.cs
- Pkcs9Attribute.cs
- SmiRecordBuffer.cs
- ContentPlaceHolder.cs
- UnsafeNativeMethods.cs
- _NtlmClient.cs
- VersionValidator.cs
- InternalConfigHost.cs
- MeshGeometry3D.cs
- AssemblyResourceLoader.cs
- FormClosingEvent.cs
- SQLChars.cs
- PageSettings.cs
- CatalogZoneDesigner.cs
- FocusChangedEventArgs.cs
- EncryptedKey.cs
- ViewPort3D.cs
- ValidateNames.cs
- XPathNodeHelper.cs
- OneOfElement.cs
- IDQuery.cs
- SiteIdentityPermission.cs
- SoapAttributeAttribute.cs
- Stylus.cs
- SqlDataSourceEnumerator.cs
- ConnectionManagementElement.cs
- ToolStripRenderer.cs
- OrderingExpression.cs
- Error.cs
- MenuItemAutomationPeer.cs
- TdsParserStateObject.cs
- InternalConfigHost.cs
- ResourceWriter.cs
- MutexSecurity.cs
- CompensationTokenData.cs
- MDIWindowDialog.cs
- DaylightTime.cs
- WeakReference.cs
- LongSumAggregationOperator.cs
- ImageSourceValueSerializer.cs
- FlowPosition.cs
- AppDomainAttributes.cs
- System.Data.OracleClient_BID.cs
- CreateUserWizardDesigner.cs
- ProcessProtocolHandler.cs
- WindowsSlider.cs
- HttpHandlersInstallComponent.cs
- SelectionItemProviderWrapper.cs
- UntypedNullExpression.cs
- ProfileBuildProvider.cs
- X509CertificateValidator.cs
- StrokeCollection2.cs
- FileVersion.cs
- MeshGeometry3D.cs
- TemplateField.cs
- IPEndPoint.cs
- XmlValidatingReader.cs
- XmlDataSource.cs
- StateBag.cs
- DeclaredTypeValidator.cs
- SessionState.cs
- ConsoleEntryPoint.cs
- ToolStripDropDownButton.cs
- WorkflowWebHostingModule.cs
- TextServicesCompartmentContext.cs
- ZipIOFileItemStream.cs
- ServiceModelStringsVersion1.cs
- XamlClipboardData.cs
- SynchronizationContextHelper.cs
- TypeElementCollection.cs
- Delegate.cs
- SecurityElement.cs
- uribuilder.cs
- InputReport.cs
- Byte.cs
- InstanceStore.cs