Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeEventLogReadHandle.cs / 1305376 / SafeEventLogReadHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeEventLogReadHandle ** **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 SafeEventLogReadHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note: OpenEventLog returns 0 on failure. internal SafeEventLogReadHandle () : base(true) { } [DllImport(ExternDll.Advapi32, CharSet=System.Runtime.InteropServices.CharSet.Unicode, SetLastError=true)] [ResourceExposure(ResourceScope.Machine)] internal static extern SafeEventLogReadHandle OpenEventLog(string UNCServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [ResourceExposure(ResourceScope.None)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool CloseEventLog(IntPtr hEventLog); override protected bool ReleaseHandle() { return CloseEventLog(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeEventLogReadHandle ** **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 SafeEventLogReadHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note: OpenEventLog returns 0 on failure. internal SafeEventLogReadHandle () : base(true) { } [DllImport(ExternDll.Advapi32, CharSet=System.Runtime.InteropServices.CharSet.Unicode, SetLastError=true)] [ResourceExposure(ResourceScope.Machine)] internal static extern SafeEventLogReadHandle OpenEventLog(string UNCServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [ResourceExposure(ResourceScope.None)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool CloseEventLog(IntPtr hEventLog); override protected bool ReleaseHandle() { return CloseEventLog(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
- ExtenderProvidedPropertyAttribute.cs
- AnimationStorage.cs
- ValueType.cs
- XNodeSchemaApplier.cs
- TimeSpanOrInfiniteConverter.cs
- EntityDesignerDataSourceView.cs
- DashStyle.cs
- Point3DConverter.cs
- HMACSHA512.cs
- WindowsMenu.cs
- AttributeExtensions.cs
- UpdatePanel.cs
- XPathSelectionIterator.cs
- CacheManager.cs
- Bold.cs
- CompiledAction.cs
- ObjectManager.cs
- SocketAddress.cs
- TreeChangeInfo.cs
- AudioStateChangedEventArgs.cs
- EditorAttribute.cs
- CommandHelper.cs
- OrderedDictionary.cs
- ScriptMethodAttribute.cs
- CaseStatement.cs
- EntityDataSourceContainerNameConverter.cs
- Floater.cs
- DbConnectionFactory.cs
- ResourcePermissionBaseEntry.cs
- ResourcePool.cs
- VirtualPathData.cs
- XmlCharType.cs
- CounterSample.cs
- FieldDescriptor.cs
- XhtmlBasicSelectionListAdapter.cs
- ActionFrame.cs
- DocComment.cs
- DictionaryEntry.cs
- SQLDateTime.cs
- SelectionPattern.cs
- TypefaceMetricsCache.cs
- Accessors.cs
- BitStream.cs
- MailWriter.cs
- SafeProcessHandle.cs
- MailAddress.cs
- CheckBoxField.cs
- SqlDataAdapter.cs
- MediaContext.cs
- ChainOfResponsibility.cs
- Int64Converter.cs
- ClientRoleProvider.cs
- EntityDataSourceColumn.cs
- PriorityChain.cs
- XmlFileEditor.cs
- DispatcherFrame.cs
- ValueSerializerAttribute.cs
- SetterBase.cs
- LogPolicy.cs
- MinimizableAttributeTypeConverter.cs
- GACMembershipCondition.cs
- CompoundFileDeflateTransform.cs
- DefaultValueTypeConverter.cs
- FileReservationCollection.cs
- DbReferenceCollection.cs
- cookiecollection.cs
- TCPListener.cs
- XmlSchemaCompilationSettings.cs
- InfoCardSymmetricAlgorithm.cs
- LeaseManager.cs
- StartFileNameEditor.cs
- Run.cs
- LessThan.cs
- CompiledQuery.cs
- HostProtectionException.cs
- Label.cs
- HitTestDrawingContextWalker.cs
- ReflectionHelper.cs
- WindowsBrush.cs
- TextRenderer.cs
- NetPeerTcpBindingCollectionElement.cs
- templategroup.cs
- ActivityExecutionContextCollection.cs
- DecimalAnimationUsingKeyFrames.cs
- SystemIcons.cs
- EventLevel.cs
- ExtensionSurface.cs
- StorageComplexTypeMapping.cs
- Schema.cs
- DecoderReplacementFallback.cs
- SqlDependencyUtils.cs
- DataGridViewAccessibleObject.cs
- StyleHelper.cs
- CodeTypeDeclaration.cs
- HttpCachePolicy.cs
- InfoCardTraceRecord.cs
- Misc.cs
- TextBoxBase.cs
- EditorAttribute.cs
- StorageSetMapping.cs