Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EventManager.cs
- SocketInformation.cs
- FormClosingEvent.cs
- EtwTrace.cs
- XmlSerializerAssemblyAttribute.cs
- SchemaMapping.cs
- UserControl.cs
- ReflectionServiceProvider.cs
- odbcmetadatafactory.cs
- TextView.cs
- DetailsViewUpdateEventArgs.cs
- KeyConstraint.cs
- SamlConditions.cs
- Int16Converter.cs
- _HelperAsyncResults.cs
- ZoneLinkButton.cs
- Parsers.cs
- XmlCDATASection.cs
- complextypematerializer.cs
- ellipse.cs
- GridItem.cs
- IteratorFilter.cs
- Boolean.cs
- ProjectionPathSegment.cs
- StaticResourceExtension.cs
- CloudCollection.cs
- EncoderNLS.cs
- MemberDescriptor.cs
- AppSettingsSection.cs
- DataTableNameHandler.cs
- FloatMinMaxAggregationOperator.cs
- ConditionBrowserDialog.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ToolStripSplitStackLayout.cs
- ColumnBinding.cs
- DispatcherOperation.cs
- AssemblyCache.cs
- CodeIndexerExpression.cs
- Vector3dCollection.cs
- XmlNamespaceMapping.cs
- ConfigurationSchemaErrors.cs
- PropertyBuilder.cs
- GlobalizationSection.cs
- ObjectContextServiceProvider.cs
- WebPartZone.cs
- DrawingGroup.cs
- ITreeGenerator.cs
- TypeSystem.cs
- InteropEnvironment.cs
- CounterSample.cs
- Cursors.cs
- AuthenticationModuleElementCollection.cs
- Help.cs
- ValidationError.cs
- TraceXPathNavigator.cs
- StringSorter.cs
- QuadraticBezierSegment.cs
- ContextStaticAttribute.cs
- ReflectEventDescriptor.cs
- selecteditemcollection.cs
- CategoryNameCollection.cs
- PenCursorManager.cs
- ListBox.cs
- IItemContainerGenerator.cs
- OutArgumentConverter.cs
- _UriSyntax.cs
- StrokeIntersection.cs
- FormViewInsertedEventArgs.cs
- DisposableCollectionWrapper.cs
- AddingNewEventArgs.cs
- HttpHandlerActionCollection.cs
- FontDifferentiator.cs
- FrameworkRichTextComposition.cs
- ObjectItemCollection.cs
- TrustManagerMoreInformation.cs
- StatusBarItem.cs
- PersonalizationStateInfo.cs
- EntityDataSourceDataSelection.cs
- EpmHelper.cs
- NetSectionGroup.cs
- InfoCardClaimCollection.cs
- RedirectionProxy.cs
- ResponseStream.cs
- BaseAutoFormat.cs
- ReflectionPermission.cs
- SettingsPropertyWrongTypeException.cs
- Propagator.ExtentPlaceholderCreator.cs
- PackageRelationship.cs
- TextStore.cs
- ApplicationFileParser.cs
- DatatypeImplementation.cs
- BasicBrowserDialog.designer.cs
- IPEndPointCollection.cs
- AttributeUsageAttribute.cs
- CollectionViewSource.cs
- Point4DValueSerializer.cs
- DataControlFieldCollection.cs
- ComboBox.cs
- EditorBrowsableAttribute.cs
- ConstNode.cs