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
- JoinCqlBlock.cs
- RewritingSimplifier.cs
- OrderablePartitioner.cs
- ExclusiveCanonicalizationTransform.cs
- CrossContextChannel.cs
- DoubleLinkList.cs
- IPHostEntry.cs
- XmlChoiceIdentifierAttribute.cs
- StreamFormatter.cs
- SerializableAttribute.cs
- DesignerLoader.cs
- ReturnEventArgs.cs
- IDReferencePropertyAttribute.cs
- NoneExcludedImageIndexConverter.cs
- VisualStyleElement.cs
- TraceContextEventArgs.cs
- UserControlDesigner.cs
- HotSpotCollectionEditor.cs
- FlowDocumentPageViewerAutomationPeer.cs
- TypeUnloadedException.cs
- RenderContext.cs
- RectIndependentAnimationStorage.cs
- Quaternion.cs
- Model3DCollection.cs
- NativeRightsManagementAPIsStructures.cs
- StateWorkerRequest.cs
- JavaScriptSerializer.cs
- EncoderFallback.cs
- XmlRootAttribute.cs
- TraceContextRecord.cs
- WebBrowserDocumentCompletedEventHandler.cs
- DefaultTextStore.cs
- HashAlgorithm.cs
- TableCell.cs
- GatewayDefinition.cs
- ConnectionPoint.cs
- InputScope.cs
- QueryRewriter.cs
- SamlSubject.cs
- PersonalizationEntry.cs
- XmlFormatExtensionPrefixAttribute.cs
- ExtenderControl.cs
- ThreadInterruptedException.cs
- SliderAutomationPeer.cs
- GeometryGroup.cs
- HotSpot.cs
- SigningDialog.cs
- XPathNodeInfoAtom.cs
- TransactionContextValidator.cs
- ToggleButtonAutomationPeer.cs
- SizeAnimation.cs
- ThumbButtonInfoCollection.cs
- XmlNode.cs
- DataTemplateSelector.cs
- CmsInterop.cs
- GridViewColumnCollectionChangedEventArgs.cs
- EncoderParameters.cs
- ExpressionVisitor.cs
- CustomAttribute.cs
- ProfileService.cs
- RTTypeWrapper.cs
- EventMap.cs
- TraceContextEventArgs.cs
- NetTcpSectionData.cs
- ActiveXSite.cs
- QuaternionKeyFrameCollection.cs
- HtmlUtf8RawTextWriter.cs
- TemplateContentLoader.cs
- GridViewEditEventArgs.cs
- QilParameter.cs
- ToggleProviderWrapper.cs
- RenderTargetBitmap.cs
- TextTreePropertyUndoUnit.cs
- CertificateManager.cs
- PagerSettings.cs
- VariableExpressionConverter.cs
- SizeAnimationClockResource.cs
- XmlSchemaProviderAttribute.cs
- HexParser.cs
- DataReceivedEventArgs.cs
- _ListenerAsyncResult.cs
- AndAlso.cs
- PolyLineSegmentFigureLogic.cs
- ExecutionEngineException.cs
- DataListCommandEventArgs.cs
- WindowsTitleBar.cs
- _RequestCacheProtocol.cs
- Pkcs7Recipient.cs
- SafeProcessHandle.cs
- OleDbParameterCollection.cs
- FilterQuery.cs
- _FtpControlStream.cs
- listitem.cs
- BigInt.cs
- IPEndPointCollection.cs
- ComponentEvent.cs
- ScrollBar.cs
- InteropDesigner.xaml.cs
- Base64Encoder.cs
- TextRenderer.cs