Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UrlMapping.cs
- ProxyGenerator.cs
- Separator.cs
- LabelAutomationPeer.cs
- ButtonStandardAdapter.cs
- ScrollBar.cs
- UshortList2.cs
- TrackingServices.cs
- OleDbParameterCollection.cs
- ProfileElement.cs
- DataQuery.cs
- CodeEventReferenceExpression.cs
- SessionIDManager.cs
- QueryOptionExpression.cs
- DataQuery.cs
- PeerToPeerException.cs
- SettingsAttributes.cs
- ObjectIDGenerator.cs
- ZipPackagePart.cs
- EntityClientCacheKey.cs
- MasterPageParser.cs
- HttpStreamFormatter.cs
- DockProviderWrapper.cs
- LogReservationCollection.cs
- FastEncoder.cs
- Image.cs
- ResourceDisplayNameAttribute.cs
- SmiContextFactory.cs
- Size.cs
- ConfigXmlSignificantWhitespace.cs
- login.cs
- DoubleAnimationUsingKeyFrames.cs
- VScrollProperties.cs
- NamespaceList.cs
- MatrixAnimationUsingPath.cs
- WebPermission.cs
- EDesignUtil.cs
- SemanticValue.cs
- ModelMemberCollection.cs
- HtmlSelect.cs
- TextParaClient.cs
- SplineQuaternionKeyFrame.cs
- CodeValidator.cs
- SystemFonts.cs
- RepeatInfo.cs
- FloaterBaseParagraph.cs
- xmlformatgeneratorstatics.cs
- XmlILIndex.cs
- DefaultWorkflowLoaderService.cs
- SortedSetDebugView.cs
- DurableMessageDispatchInspector.cs
- DetailsViewUpdateEventArgs.cs
- StorageTypeMapping.cs
- MouseBinding.cs
- MarshalDirectiveException.cs
- NamespaceCollection.cs
- uribuilder.cs
- ScaleTransform3D.cs
- SeverityFilter.cs
- GeometryGroup.cs
- NumberFunctions.cs
- EntityDataSourceViewSchema.cs
- AssemblySettingAttributes.cs
- Canonicalizers.cs
- SerializerWriterEventHandlers.cs
- Rectangle.cs
- DynamicQueryableWrapper.cs
- KeySplineConverter.cs
- NavigationProgressEventArgs.cs
- dbdatarecord.cs
- Keywords.cs
- X509ChainPolicy.cs
- TimelineCollection.cs
- Msmq.cs
- OdbcError.cs
- DetailsViewModeEventArgs.cs
- AutomationPropertyInfo.cs
- PropertyChangeTracker.cs
- ContentTextAutomationPeer.cs
- DesignerRegionCollection.cs
- ButtonPopupAdapter.cs
- WebConfigurationFileMap.cs
- InputProcessorProfilesLoader.cs
- TraceHandlerErrorFormatter.cs
- SrgsItemList.cs
- HttpCachePolicyWrapper.cs
- WebBrowserNavigatingEventHandler.cs
- TreeView.cs
- SliderAutomationPeer.cs
- OverloadGroupAttribute.cs
- DateTimeFormatInfoScanner.cs
- GridViewItemAutomationPeer.cs
- ShadowGlyph.cs
- XpsS0ValidatingLoader.cs
- Error.cs
- VectorAnimation.cs
- HttpListenerRequest.cs
- SdlChannelSink.cs
- Matrix3D.cs
- Single.cs