Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeEventLogReadHandle.cs / 1 / 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; 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)] internal static extern SafeEventLogReadHandle OpenEventLog(string UNCServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [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; 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)] internal static extern SafeEventLogReadHandle OpenEventLog(string UNCServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [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
- BinaryNode.cs
- ErrorWebPart.cs
- DescendentsWalker.cs
- ObjectQuery_EntitySqlExtensions.cs
- CodePageEncoding.cs
- DataContractSet.cs
- Rotation3D.cs
- ExpressionNormalizer.cs
- TileModeValidation.cs
- MimeParameters.cs
- PropertyRecord.cs
- DecoderFallbackWithFailureFlag.cs
- TemplateBuilder.cs
- DefaultPropertyAttribute.cs
- ChangeNode.cs
- IncrementalReadDecoders.cs
- ClientScriptItem.cs
- ChildDocumentBlock.cs
- SwitchElementsCollection.cs
- WebZone.cs
- KnownIds.cs
- XslNumber.cs
- XsltFunctions.cs
- EpmCustomContentDeSerializer.cs
- AmbientLight.cs
- ReaderOutput.cs
- FixedSOMLineCollection.cs
- FormViewRow.cs
- __Filters.cs
- FaultReason.cs
- SoapHeaderAttribute.cs
- Condition.cs
- XmlAttributeCollection.cs
- FindResponse.cs
- UrlMappingCollection.cs
- EntityClientCacheEntry.cs
- COM2PictureConverter.cs
- RectangleConverter.cs
- DPCustomTypeDescriptor.cs
- ContentDefinition.cs
- dataprotectionpermission.cs
- ComPlusSynchronizationContext.cs
- glyphs.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- FontFamily.cs
- FunctionDefinition.cs
- CodeAssignStatement.cs
- SqlException.cs
- DataPointer.cs
- ButtonChrome.cs
- StructuredTypeEmitter.cs
- CollectionViewGroup.cs
- GraphicsContext.cs
- selecteditemcollection.cs
- EntityDataSourceEntityTypeFilterItem.cs
- SplitterCancelEvent.cs
- LongTypeConverter.cs
- Constraint.cs
- StandardCommands.cs
- ToolStripRendererSwitcher.cs
- keycontainerpermission.cs
- Utility.cs
- PasswordBoxAutomationPeer.cs
- QuaternionAnimationUsingKeyFrames.cs
- DataSourceView.cs
- TemplatePropertyEntry.cs
- FixedSOMElement.cs
- sqlpipe.cs
- TemplateEditingFrame.cs
- DataSpaceManager.cs
- GridViewEditEventArgs.cs
- Int64Animation.cs
- AppPool.cs
- BitmapEffectGeneralTransform.cs
- Thickness.cs
- HostedElements.cs
- ImageListUtils.cs
- ALinqExpressionVisitor.cs
- XNodeNavigator.cs
- FormatConvertedBitmap.cs
- GridViewColumn.cs
- _AcceptOverlappedAsyncResult.cs
- ManipulationStartingEventArgs.cs
- OuterProxyWrapper.cs
- BamlLocalizer.cs
- SystemResourceKey.cs
- ContainerParagraph.cs
- JavaScriptObjectDeserializer.cs
- PartialList.cs
- EmptyEnumerable.cs
- NativeRecognizer.cs
- EnumConverter.cs
- CompositeCollection.cs
- ImageBrush.cs
- WindowsGrip.cs
- UIElementAutomationPeer.cs
- AnimationClockResource.cs
- Constants.cs
- PageAsyncTask.cs
- TextProperties.cs