Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeEventLogWriteHandle.cs / 1305376 / SafeEventLogWriteHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeEventLogWriteHandle ** **Author: David Gutierrez ([....]) ** ** A wrapper for event log handles ** ** Date: July 8, 2002 ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; namespace Microsoft.Win32.SafeHandles { [HostProtectionAttribute(MayLeakOnAbort = true)] [SuppressUnmanagedCodeSecurityAttribute] internal sealed class SafeEventLogWriteHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note: RegisterEventSource returns 0 on failure internal SafeEventLogWriteHandle () : base(true) {} [DllImport(ExternDll.Advapi32, CharSet=System.Runtime.InteropServices.CharSet.Unicode, SetLastError=true)] [ResourceExposure(ResourceScope.Machine)] internal static extern SafeEventLogWriteHandle RegisterEventSource(string uncServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [ResourceExposure(ResourceScope.None)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool DeregisterEventSource(IntPtr hEventLog); override protected bool ReleaseHandle() { return DeregisterEventSource(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeEventLogWriteHandle ** **Author: David Gutierrez ([....]) ** ** A wrapper for event log handles ** ** Date: July 8, 2002 ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; namespace Microsoft.Win32.SafeHandles { [HostProtectionAttribute(MayLeakOnAbort = true)] [SuppressUnmanagedCodeSecurityAttribute] internal sealed class SafeEventLogWriteHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note: RegisterEventSource returns 0 on failure internal SafeEventLogWriteHandle () : base(true) {} [DllImport(ExternDll.Advapi32, CharSet=System.Runtime.InteropServices.CharSet.Unicode, SetLastError=true)] [ResourceExposure(ResourceScope.Machine)] internal static extern SafeEventLogWriteHandle RegisterEventSource(string uncServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [ResourceExposure(ResourceScope.None)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool DeregisterEventSource(IntPtr hEventLog); override protected bool ReleaseHandle() { return DeregisterEventSource(handle); } } } // 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
- EmptyEnumerable.cs
- Activator.cs
- DataObjectPastingEventArgs.cs
- ScheduleChanges.cs
- TrustLevel.cs
- remotingproxy.cs
- ProjectedSlot.cs
- WebPartCatalogCloseVerb.cs
- BaseHashHelper.cs
- SqlUtils.cs
- RangeBaseAutomationPeer.cs
- Int64Converter.cs
- TheQuery.cs
- AnnotationResourceCollection.cs
- MatrixValueSerializer.cs
- View.cs
- EncodingDataItem.cs
- SafeEventLogWriteHandle.cs
- ConstructorNeedsTagAttribute.cs
- Size3D.cs
- URL.cs
- GenericIdentity.cs
- ByteAnimationUsingKeyFrames.cs
- DataFormat.cs
- TimeEnumHelper.cs
- Int16KeyFrameCollection.cs
- InvokePatternIdentifiers.cs
- InstanceHandleConflictException.cs
- FormViewInsertedEventArgs.cs
- EditorPartCollection.cs
- TextRunTypographyProperties.cs
- EdmRelationshipRoleAttribute.cs
- _NtlmClient.cs
- ObjectListCommandEventArgs.cs
- ModelUIElement3D.cs
- Container.cs
- SystemWebSectionGroup.cs
- ProfilePropertySettings.cs
- DSACryptoServiceProvider.cs
- SparseMemoryStream.cs
- HostingEnvironmentWrapper.cs
- StylusEventArgs.cs
- CompatibleIComparer.cs
- CheckBoxField.cs
- BitmapEffect.cs
- SHA512Managed.cs
- InputProcessorProfilesLoader.cs
- HttpWebRequest.cs
- BitmapFrame.cs
- WhitespaceReader.cs
- GCHandleCookieTable.cs
- GridViewRowCollection.cs
- AdornedElementPlaceholder.cs
- HttpListenerContext.cs
- _AcceptOverlappedAsyncResult.cs
- ScriptControl.cs
- AutoResetEvent.cs
- BidOverLoads.cs
- GacUtil.cs
- ManifestSignedXml.cs
- AppendHelper.cs
- Misc.cs
- _WinHttpWebProxyDataBuilder.cs
- NameObjectCollectionBase.cs
- BamlLocalizableResource.cs
- XPathAncestorQuery.cs
- MobileControlBuilder.cs
- NumberAction.cs
- URLString.cs
- SHA384Managed.cs
- InputScopeAttribute.cs
- CodeGotoStatement.cs
- ParameterModifier.cs
- ReadOnlyTernaryTree.cs
- XmlChildNodes.cs
- DataTableNameHandler.cs
- SmtpNegotiateAuthenticationModule.cs
- AffineTransform3D.cs
- HotSpot.cs
- ObjectQuery.cs
- UriTemplateQueryValue.cs
- CompoundFileStorageReference.cs
- JsonCollectionDataContract.cs
- JsonByteArrayDataContract.cs
- EntityObject.cs
- HttpModuleAction.cs
- PipelineModuleStepContainer.cs
- InkPresenter.cs
- CodeCatchClauseCollection.cs
- Span.cs
- FixedPosition.cs
- RelationshipEndCollection.cs
- ImageDrawing.cs
- XmlComplianceUtil.cs
- DataServiceQueryOfT.cs
- Animatable.cs
- EntitySetBase.cs
- CreateUserWizardStep.cs
- CodeRemoveEventStatement.cs
- Point3DIndependentAnimationStorage.cs