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
- Tracer.cs
- UrlAuthFailedErrorFormatter.cs
- ThreadExceptionDialog.cs
- SQLSingleStorage.cs
- PeerReferralPolicy.cs
- VirtualPathExtension.cs
- FrameworkRichTextComposition.cs
- TypographyProperties.cs
- EncoderParameter.cs
- PartitionResolver.cs
- CorrelationQuery.cs
- XPathSelectionIterator.cs
- InputScopeAttribute.cs
- NameSpaceExtractor.cs
- DataGridViewAccessibleObject.cs
- DeploymentSection.cs
- ComponentCommands.cs
- DataTable.cs
- LogicalExpressionEditor.cs
- ConnectionInterfaceCollection.cs
- RuntimeVariableList.cs
- XmlEncodedRawTextWriter.cs
- ExtensibleClassFactory.cs
- SqlGenerator.cs
- BitHelper.cs
- DESCryptoServiceProvider.cs
- EncoderParameter.cs
- InheritanceContextChangedEventManager.cs
- XmlReflectionMember.cs
- XmlCharCheckingWriter.cs
- AsyncCodeActivity.cs
- GregorianCalendarHelper.cs
- TextServicesContext.cs
- DataSourceHelper.cs
- AbstractDataSvcMapFileLoader.cs
- KeyFrames.cs
- Activity.cs
- ObjectQueryState.cs
- DocumentViewerBaseAutomationPeer.cs
- XmlWriter.cs
- XmlNodeList.cs
- SamlAuthorityBinding.cs
- PeerName.cs
- WebBrowsableAttribute.cs
- Listbox.cs
- precedingsibling.cs
- UnsafeCollabNativeMethods.cs
- MasterPageBuildProvider.cs
- ComPlusDiagnosticTraceSchemas.cs
- GridItem.cs
- SqlXml.cs
- WindowsListViewItemStartMenu.cs
- LineProperties.cs
- Int64Storage.cs
- CommentAction.cs
- ConnectionStringsExpressionBuilder.cs
- GPPOINTF.cs
- TableRowGroup.cs
- FormsAuthenticationConfiguration.cs
- _DigestClient.cs
- infer.cs
- UpnEndpointIdentity.cs
- ChangeDirector.cs
- ObjectContext.cs
- Composition.cs
- MediaElementAutomationPeer.cs
- CalendarDay.cs
- RemoteHelper.cs
- Identifier.cs
- String.cs
- OrderedDictionary.cs
- DataObject.cs
- AutomationProperties.cs
- PtsContext.cs
- SpotLight.cs
- XmlSerializationWriter.cs
- TextRangeAdaptor.cs
- StorageEntitySetMapping.cs
- TextSelectionHelper.cs
- SecurityTokenResolver.cs
- RegistryPermission.cs
- EntityDataSourceContextDisposingEventArgs.cs
- NegationPusher.cs
- EntityDataSourceValidationException.cs
- DeclaredTypeElement.cs
- X509WindowsSecurityToken.cs
- PixelFormat.cs
- PopOutPanel.cs
- PersonalizationAdministration.cs
- Fonts.cs
- CustomMenuItemCollection.cs
- QilInvokeLateBound.cs
- CompilerErrorCollection.cs
- ProviderSettingsCollection.cs
- HtmlInputText.cs
- CodeCatchClauseCollection.cs
- InvalidDocumentContentsException.cs
- EdmTypeAttribute.cs
- ReaderWriterLockWrapper.cs
- DataSourceConverter.cs