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
- IItemProperties.cs
- EntityModelSchemaGenerator.cs
- RoutedPropertyChangedEventArgs.cs
- CommentAction.cs
- HierarchicalDataSourceControl.cs
- ObjectDataSourceMethodEventArgs.cs
- XmlDocumentType.cs
- TokenizerHelper.cs
- FontStretch.cs
- GridViewDeletedEventArgs.cs
- SoapInteropTypes.cs
- PrePostDescendentsWalker.cs
- DefaultDiscoveryServiceExtension.cs
- MobileSysDescriptionAttribute.cs
- ModelTreeManager.cs
- PropertyStore.cs
- IImplicitResourceProvider.cs
- Instrumentation.cs
- ProtocolsConfigurationEntry.cs
- DSASignatureFormatter.cs
- WebPartActionVerb.cs
- ChangeTracker.cs
- CodeThrowExceptionStatement.cs
- CryptoSession.cs
- EmptyStringExpandableObjectConverter.cs
- MemoryFailPoint.cs
- SerializationEventsCache.cs
- IndexedString.cs
- FlowDocumentPageViewerAutomationPeer.cs
- TextSearch.cs
- RecordsAffectedEventArgs.cs
- BindingGroup.cs
- CurrentTimeZone.cs
- CellCreator.cs
- WbemProvider.cs
- StoryFragments.cs
- AppSettingsExpressionBuilder.cs
- MDIWindowDialog.cs
- ObjectDataSource.cs
- ColumnCollection.cs
- KnownBoxes.cs
- DataGridViewTextBoxEditingControl.cs
- PeerTransportSecuritySettings.cs
- DrawToolTipEventArgs.cs
- OracleNumber.cs
- DispatcherProcessingDisabled.cs
- DiscoveryClientRequestChannel.cs
- FontCacheLogic.cs
- DispatcherEventArgs.cs
- OrCondition.cs
- ComponentResourceManager.cs
- Timer.cs
- EntityWithKeyStrategy.cs
- TableColumn.cs
- ContextMarshalException.cs
- XmlAtomicValue.cs
- EventToken.cs
- FixedSOMFixedBlock.cs
- BufferedGraphics.cs
- SqlSupersetValidator.cs
- HandlerBase.cs
- CompatibleComparer.cs
- Roles.cs
- XamlFigureLengthSerializer.cs
- EventSinkHelperWriter.cs
- XPathMessageFilterElementComparer.cs
- DataRecordObjectView.cs
- DbDataAdapter.cs
- PlanCompilerUtil.cs
- MsmqIntegrationValidationBehavior.cs
- httpstaticobjectscollection.cs
- ExitEventArgs.cs
- BindingExpressionBase.cs
- AuthenticationModulesSection.cs
- ValidationHelpers.cs
- NonBatchDirectoryCompiler.cs
- TextSearch.cs
- XmlUnspecifiedAttribute.cs
- EndPoint.cs
- FileRegion.cs
- TextModifierScope.cs
- ChtmlTextWriter.cs
- ExtendedTransformFactory.cs
- Switch.cs
- X509Certificate2Collection.cs
- BinaryVersion.cs
- CustomAssemblyResolver.cs
- DispatcherEventArgs.cs
- InstalledFontCollection.cs
- BasicCellRelation.cs
- ReferenceConverter.cs
- ConnectionPointCookie.cs
- XPathScanner.cs
- MeshGeometry3D.cs
- ResourceDisplayNameAttribute.cs
- XmlAnyElementAttribute.cs
- XmlCharacterData.cs
- NativeRecognizer.cs
- GeneralTransform3D.cs
- ValueTypeFixupInfo.cs