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
- Utilities.cs
- MD5CryptoServiceProvider.cs
- ToolStripDropDownButton.cs
- WindowInteractionStateTracker.cs
- MetabaseServerConfig.cs
- ContentIterators.cs
- Expressions.cs
- LoginName.cs
- Span.cs
- PeerApplicationLaunchInfo.cs
- RegexGroup.cs
- FileAuthorizationModule.cs
- PathParser.cs
- EditorPartChrome.cs
- SymbolUsageManager.cs
- HashHelpers.cs
- AccessViolationException.cs
- TableRowGroup.cs
- Span.cs
- TrustLevel.cs
- RectangleGeometry.cs
- ImageSourceTypeConverter.cs
- ManagementInstaller.cs
- ImageListStreamer.cs
- NameTable.cs
- MobileFormsAuthentication.cs
- FixedPageStructure.cs
- InternalTypeHelper.cs
- LabelExpression.cs
- StorageAssociationSetMapping.cs
- FormViewPageEventArgs.cs
- ChannelFactory.cs
- InstalledFontCollection.cs
- EntityDataSourceStatementEditor.cs
- CookieParameter.cs
- RtfControls.cs
- LabelLiteral.cs
- BuildResultCache.cs
- ResourceDefaultValueAttribute.cs
- EnumValAlphaComparer.cs
- MatchingStyle.cs
- SoapSchemaMember.cs
- AsyncResult.cs
- CqlBlock.cs
- newitemfactory.cs
- InternalDispatchObject.cs
- ProfileSection.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- RuntimeComponentFilter.cs
- Sql8ConformanceChecker.cs
- AdornerPresentationContext.cs
- NextPreviousPagerField.cs
- DataGridItemCollection.cs
- GrammarBuilderDictation.cs
- JoinCqlBlock.cs
- ProjectionCamera.cs
- TraceFilter.cs
- ApplicationGesture.cs
- TypeConverterAttribute.cs
- ExternalCalls.cs
- ApplicationDirectoryMembershipCondition.cs
- StylusPlugInCollection.cs
- ExpressionBindingCollection.cs
- ThousandthOfEmRealDoubles.cs
- CodeTryCatchFinallyStatement.cs
- SmiContext.cs
- DetailsViewInsertEventArgs.cs
- DataGridColumnCollection.cs
- SymmetricKey.cs
- ViewBase.cs
- TextElementCollection.cs
- LinearGradientBrush.cs
- AccessibleObject.cs
- SystemInformation.cs
- SerializableAttribute.cs
- IPipelineRuntime.cs
- XsdValidatingReader.cs
- MDIClient.cs
- Blend.cs
- CounterNameConverter.cs
- GlyphsSerializer.cs
- ZipIORawDataFileBlock.cs
- DataMisalignedException.cs
- CryptoStream.cs
- CatalogPart.cs
- CorrelationValidator.cs
- PointCollectionConverter.cs
- FreezableOperations.cs
- _IPv6Address.cs
- Touch.cs
- ServicePoint.cs
- MouseGestureConverter.cs
- DotNetATv1WindowsLogEntryDeserializer.cs
- ClientOptions.cs
- Matrix3D.cs
- _UriSyntax.cs
- SoapParser.cs
- RegexTree.cs
- UnsettableComboBox.cs
- FloatSumAggregationOperator.cs