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
- BaseParser.cs
- SqlRemoveConstantOrderBy.cs
- documentsequencetextpointer.cs
- Delegate.cs
- PageParser.cs
- FontClient.cs
- TreeViewBindingsEditor.cs
- WindowShowOrOpenTracker.cs
- KeyFrames.cs
- GZipUtils.cs
- DiscoveryClientReferences.cs
- WebBrowserPermission.cs
- CompositeDesignerAccessibleObject.cs
- WindowsTreeView.cs
- VisualBasicSettingsHandler.cs
- SoapIncludeAttribute.cs
- SQLGuidStorage.cs
- XmlSignificantWhitespace.cs
- AttachedPropertyMethodSelector.cs
- DocumentXmlWriter.cs
- ToolStripItemCollection.cs
- MailBnfHelper.cs
- CounterSampleCalculator.cs
- Properties.cs
- DependencyObjectProvider.cs
- RuleInfoComparer.cs
- XmlNotation.cs
- EmbeddedMailObject.cs
- cookieexception.cs
- IteratorFilter.cs
- XmlBoundElement.cs
- FileStream.cs
- HtmlForm.cs
- HttpChannelHelpers.cs
- WebServiceData.cs
- InkCanvasSelection.cs
- ServiceContractGenerator.cs
- SQLBinary.cs
- MatrixTransform.cs
- WeakReferenceList.cs
- Base64Stream.cs
- Matrix3DValueSerializer.cs
- SignerInfo.cs
- SqlPersonalizationProvider.cs
- MetadataArtifactLoaderResource.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- XmlWriterTraceListener.cs
- PolyQuadraticBezierSegment.cs
- FileClassifier.cs
- InsufficientMemoryException.cs
- ContractNamespaceAttribute.cs
- PageTrueTypeFont.cs
- BindableAttribute.cs
- DrawingVisual.cs
- OutOfProcStateClientManager.cs
- DeclarationUpdate.cs
- FieldInfo.cs
- ModuleConfigurationInfo.cs
- CultureMapper.cs
- GridViewRowEventArgs.cs
- WindowsSidIdentity.cs
- DataGridViewTopLeftHeaderCell.cs
- ViewCellSlot.cs
- InstalledFontCollection.cs
- WebRequestModuleElementCollection.cs
- ReferenceSchema.cs
- CubicEase.cs
- VBIdentifierNameEditor.cs
- WebPartZoneBaseDesigner.cs
- PropertyValue.cs
- OdbcPermission.cs
- DataKeyCollection.cs
- CodeStatementCollection.cs
- UriSection.cs
- DrawToolTipEventArgs.cs
- WCFBuildProvider.cs
- HostedHttpRequestAsyncResult.cs
- ReadOnlyDictionary.cs
- CodeDirectiveCollection.cs
- ConnectionPointConverter.cs
- Geometry3D.cs
- Operators.cs
- SafeNativeMethods.cs
- LookupTables.cs
- ACL.cs
- TryCatchDesigner.xaml.cs
- DispatcherTimer.cs
- HtmlInputReset.cs
- TreeIterator.cs
- TrackBarRenderer.cs
- ContextQuery.cs
- PersonalizationStateInfoCollection.cs
- ListCollectionView.cs
- SessionSwitchEventArgs.cs
- StylusButton.cs
- BuildProvidersCompiler.cs
- RegularExpressionValidator.cs
- WebPartConnectionsCancelEventArgs.cs
- SafeThreadHandle.cs
- SiteMapHierarchicalDataSourceView.cs