Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeEventLogWriteHandle.cs / 1 / 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; 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)] internal static extern SafeEventLogWriteHandle RegisterEventSource(string uncServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool DeregisterEventSource(IntPtr hEventLog); override protected bool ReleaseHandle() { return DeregisterEventSource(handle); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExpressionVisitor.cs
- BulletChrome.cs
- EditorZoneBase.cs
- BypassElementCollection.cs
- XmlReturnWriter.cs
- XmlBoundElement.cs
- Size.cs
- OptimisticConcurrencyException.cs
- GlyphRunDrawing.cs
- ContainerParagraph.cs
- CaseInsensitiveOrdinalStringComparer.cs
- SafePEFileHandle.cs
- PtsHelper.cs
- ZipIOExtraFieldElement.cs
- MetadataArtifactLoaderFile.cs
- HttpSessionStateBase.cs
- WebPartConnectionsCloseVerb.cs
- SettingsBindableAttribute.cs
- XmlLinkedNode.cs
- BatchWriter.cs
- ObjectMemberMapping.cs
- GestureRecognitionResult.cs
- FixedHighlight.cs
- SectionUpdates.cs
- SafeCryptoHandles.cs
- ContentPresenter.cs
- WorkflowMarkupSerializationException.cs
- ObjectListItem.cs
- ProcessInfo.cs
- TraceLog.cs
- AutomationElementIdentifiers.cs
- InlineObject.cs
- PointCollection.cs
- TextContainerHelper.cs
- SQLMoneyStorage.cs
- SiteMapProvider.cs
- Transform.cs
- PersonalizationProviderCollection.cs
- BrowserTree.cs
- _AutoWebProxyScriptWrapper.cs
- SqlDataSource.cs
- WbmpConverter.cs
- RubberbandSelector.cs
- MultiSelectRootGridEntry.cs
- StrokeNode.cs
- SchemaMapping.cs
- StyleHelper.cs
- KnownBoxes.cs
- FrameworkName.cs
- MemoryPressure.cs
- MobileControlsSectionHandler.cs
- InvalidContentTypeException.cs
- EventEntry.cs
- StringFormat.cs
- DataServices.cs
- RotateTransform.cs
- FontCacheLogic.cs
- ConnectionManagementElement.cs
- ObjectParameterCollection.cs
- KnownColorTable.cs
- ClassGenerator.cs
- XmlDesignerDataSourceView.cs
- ActivityCollectionMarkupSerializer.cs
- COAUTHINFO.cs
- TemplateControlCodeDomTreeGenerator.cs
- UICuesEvent.cs
- CodeIndexerExpression.cs
- AbstractSvcMapFileLoader.cs
- AssemblyNameUtility.cs
- PrePostDescendentsWalker.cs
- SrgsItemList.cs
- DbConnectionHelper.cs
- ListQueryResults.cs
- MultiPropertyDescriptorGridEntry.cs
- HttpResponseInternalWrapper.cs
- ToolStripPanel.cs
- ReadOnlyHierarchicalDataSourceView.cs
- DateTimeOffsetConverter.cs
- SoapReflectionImporter.cs
- ListDataBindEventArgs.cs
- WpfWebRequestHelper.cs
- SymbolMethod.cs
- wmiprovider.cs
- XamlClipboardData.cs
- CheckoutException.cs
- SimpleTypeResolver.cs
- SpeechRecognizer.cs
- SqlUtil.cs
- SctClaimSerializer.cs
- RuleSetDialog.Designer.cs
- VirtualPathUtility.cs
- DecimalStorage.cs
- EventRouteFactory.cs
- OpCodes.cs
- ConnectionStringSettingsCollection.cs
- ChannelCacheDefaults.cs
- StringToken.cs
- wpf-etw.cs
- _HeaderInfo.cs
- FixedSOMPageConstructor.cs