Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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); } } } // 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; 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); } } } // 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
- SynchronizationScope.cs
- SortedDictionary.cs
- Size.cs
- ListViewInsertionMark.cs
- GACMembershipCondition.cs
- SettingsPropertyValueCollection.cs
- Stackframe.cs
- NativeRightsManagementAPIsStructures.cs
- OdbcUtils.cs
- DataServiceHostWrapper.cs
- TaskFormBase.cs
- MimeObjectFactory.cs
- GAC.cs
- XmlReflectionMember.cs
- ErrorItem.cs
- ClientProxyGenerator.cs
- ClickablePoint.cs
- DeploymentSection.cs
- RouteTable.cs
- DuplexClientBase.cs
- XamlWrappingReader.cs
- LoadMessageLogger.cs
- DataGridTextBox.cs
- ConfigurationPermission.cs
- DataGridViewRowPrePaintEventArgs.cs
- LazyTextWriterCreator.cs
- TableLayoutCellPaintEventArgs.cs
- WmfPlaceableFileHeader.cs
- CompoundFileIOPermission.cs
- NumberFormatInfo.cs
- WeakReadOnlyCollection.cs
- ColorMatrix.cs
- ProcessHostFactoryHelper.cs
- RuleSettingsCollection.cs
- QueuePropertyVariants.cs
- WindowsToolbarItemAsMenuItem.cs
- IssuanceTokenProviderBase.cs
- XslNumber.cs
- RootBrowserWindow.cs
- ResourcePermissionBaseEntry.cs
- CertificateReferenceElement.cs
- ELinqQueryState.cs
- AuthorizationSection.cs
- Merger.cs
- EventPrivateKey.cs
- oledbconnectionstring.cs
- Geometry.cs
- ProfilePropertySettingsCollection.cs
- CommonRemoteMemoryBlock.cs
- ControlCollection.cs
- DSACryptoServiceProvider.cs
- JsonFaultDetail.cs
- GridViewColumnHeaderAutomationPeer.cs
- ItemCollection.cs
- RectAnimation.cs
- LicenseException.cs
- KeyBinding.cs
- DataServiceException.cs
- smtpconnection.cs
- SystemTcpConnection.cs
- Util.cs
- EncodingDataItem.cs
- TypeSystem.cs
- GestureRecognizer.cs
- TextInfo.cs
- ContourSegment.cs
- UpdateRecord.cs
- TrackingLocation.cs
- SqlServices.cs
- ReliableSessionBindingElementImporter.cs
- HttpResponse.cs
- MetaTableHelper.cs
- DoubleSumAggregationOperator.cs
- TemplateBuilder.cs
- RequestSecurityTokenSerializer.cs
- ReadOnlyDataSourceView.cs
- MatrixCamera.cs
- SolidBrush.cs
- XmlDocument.cs
- Cursor.cs
- SqlRemoveConstantOrderBy.cs
- RawMouseInputReport.cs
- Compiler.cs
- Clock.cs
- AnnotationObservableCollection.cs
- MemoryFailPoint.cs
- Thread.cs
- DPAPIProtectedConfigurationProvider.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- IItemProperties.cs
- Latin1Encoding.cs
- DateTimeOffset.cs
- XmlSerializationReader.cs
- MemoryStream.cs
- DesignSurfaceEvent.cs
- HttpDictionary.cs
- CorruptingExceptionCommon.cs
- WorkflowApplicationUnloadedException.cs
- AppDomainAttributes.cs
- Transform3D.cs