Code:
/ DotNET / DotNET / 8.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
- DesignerTextBoxAdapter.cs
- SchemaImporter.cs
- HttpModule.cs
- EventWaitHandle.cs
- httpapplicationstate.cs
- ThreadStaticAttribute.cs
- SqlTriggerContext.cs
- GroupBoxRenderer.cs
- CompilerCollection.cs
- EncoderFallback.cs
- xmlformatgeneratorstatics.cs
- ClientScriptManager.cs
- Glyph.cs
- ContactManager.cs
- Registry.cs
- WindowsFormsHostPropertyMap.cs
- PaperSize.cs
- TypedColumnHandler.cs
- Model3DCollection.cs
- EnvelopedPkcs7.cs
- ConnectionStringSettingsCollection.cs
- UriPrefixTable.cs
- SqlMethods.cs
- PropertyGridEditorPart.cs
- TextTreeUndoUnit.cs
- ExpressionCopier.cs
- EmulateRecognizeCompletedEventArgs.cs
- FileSystemInfo.cs
- DbConnectionStringCommon.cs
- ConfigurationManagerHelperFactory.cs
- Lease.cs
- UiaCoreProviderApi.cs
- NGCPageContentSerializerAsync.cs
- ScrollPatternIdentifiers.cs
- ScriptControlManager.cs
- StringArrayConverter.cs
- CompensateDesigner.cs
- WebBrowser.cs
- NetPeerTcpBinding.cs
- MediaContext.cs
- CustomBindingCollectionElement.cs
- CaseCqlBlock.cs
- RowsCopiedEventArgs.cs
- UriSection.cs
- CodeAssignStatement.cs
- Image.cs
- ExitEventArgs.cs
- StreamInfo.cs
- SerTrace.cs
- CatalogPartChrome.cs
- TraceFilter.cs
- UidPropertyAttribute.cs
- WSHttpBindingBase.cs
- HyperlinkAutomationPeer.cs
- PointAnimation.cs
- BooleanFacetDescriptionElement.cs
- TextTreeTextBlock.cs
- ContractHandle.cs
- SSmlParser.cs
- TranslateTransform.cs
- AmbientValueAttribute.cs
- InfocardInteractiveChannelInitializer.cs
- ScriptIgnoreAttribute.cs
- PolyLineSegment.cs
- CommonProperties.cs
- TransportContext.cs
- IgnoreSectionHandler.cs
- JsonWriter.cs
- ViewSimplifier.cs
- BaseTemplateBuildProvider.cs
- ISAPIRuntime.cs
- WebPartMinimizeVerb.cs
- CmsUtils.cs
- TextEditorLists.cs
- AssemblyLoader.cs
- InstanceDescriptor.cs
- DataGridViewRowPostPaintEventArgs.cs
- MultiTrigger.cs
- DbConnectionPoolIdentity.cs
- PrintEvent.cs
- AspNetHostingPermission.cs
- BindingExpressionBase.cs
- IntPtr.cs
- DbMetaDataColumnNames.cs
- CollectionBuilder.cs
- EditableTreeList.cs
- FontStyles.cs
- ConfigXmlWhitespace.cs
- TrackingProfileManager.cs
- Socket.cs
- HtmlProps.cs
- PriorityItem.cs
- AndCondition.cs
- RouteItem.cs
- Encoder.cs
- EmptyControlCollection.cs
- RoleManagerModule.cs
- InheritablePropertyChangeInfo.cs
- MouseEventArgs.cs
- TransformationRules.cs