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
- RegexWorker.cs
- AuthenticationSchemesHelper.cs
- HMACRIPEMD160.cs
- Color.cs
- XpsFixedDocumentReaderWriter.cs
- EntityDataSourceColumn.cs
- XmlSchemaObject.cs
- FixUpCollection.cs
- RijndaelManaged.cs
- FilterableAttribute.cs
- State.cs
- VectorAnimationBase.cs
- BitmapEffectState.cs
- WindowsUpDown.cs
- TextSpan.cs
- FlowLayout.cs
- DesignerActionHeaderItem.cs
- InternalBufferOverflowException.cs
- RowTypeElement.cs
- DynamicPhysicalDiscoSearcher.cs
- FixedDocumentPaginator.cs
- CredentialCache.cs
- SimpleApplicationHost.cs
- SplashScreenNativeMethods.cs
- InnerItemCollectionView.cs
- ConfigurationPermission.cs
- ConnectionManagementSection.cs
- IndicShape.cs
- ComponentFactoryHelpers.cs
- RSAPKCS1SignatureDeformatter.cs
- Compiler.cs
- ToolboxComponentsCreatingEventArgs.cs
- SerializationTrace.cs
- FlowNode.cs
- Pen.cs
- Run.cs
- MarginCollapsingState.cs
- UnsafeNativeMethodsMilCoreApi.cs
- MaskedTextBoxTextEditor.cs
- InputMethodStateChangeEventArgs.cs
- BaseCAMarshaler.cs
- CharacterBuffer.cs
- WebContext.cs
- LiteralLink.cs
- CodeCommentStatementCollection.cs
- SizeAnimationClockResource.cs
- DataViewManager.cs
- _NegotiateClient.cs
- ListViewItem.cs
- NetworkInformationException.cs
- TextTreeTextBlock.cs
- ProfileSettings.cs
- CanonicalFontFamilyReference.cs
- FontNameEditor.cs
- KnownAssembliesSet.cs
- XmlSchemaChoice.cs
- TextServicesLoader.cs
- ClassHandlersStore.cs
- DataGridViewLinkColumn.cs
- MailAddressCollection.cs
- AccessDataSourceView.cs
- ExeConfigurationFileMap.cs
- RangeValidator.cs
- SoapFault.cs
- ComponentResourceManager.cs
- TextDecorationLocationValidation.cs
- TypeValidationEventArgs.cs
- WebBrowserPermission.cs
- AutomationPatternInfo.cs
- StylusButtonCollection.cs
- securitycriticaldataformultiplegetandset.cs
- AsyncStreamReader.cs
- LogoValidationException.cs
- TreeViewItem.cs
- MultiView.cs
- DataConnectionHelper.cs
- XmlQualifiedNameTest.cs
- MostlySingletonList.cs
- CodeGenerator.cs
- TypefaceCollection.cs
- DataControlPagerLinkButton.cs
- CodeSubDirectoriesCollection.cs
- SqlXmlStorage.cs
- SqlNode.cs
- StyleBamlRecordReader.cs
- SqlPersonalizationProvider.cs
- OpacityConverter.cs
- CqlWriter.cs
- ObjectParameterCollection.cs
- RootProfilePropertySettingsCollection.cs
- MappingModelBuildProvider.cs
- PersistStreamTypeWrapper.cs
- SHA384.cs
- ExpressionLink.cs
- BitmapPalette.cs
- NotifyInputEventArgs.cs
- DynamicMethod.cs
- tabpagecollectioneditor.cs
- validationstate.cs
- StreamWithDictionary.cs