Code:
/ FX-1434 / FX-1434 / 1.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
- SQLGuidStorage.cs
- SoapMessage.cs
- SoapServerMethod.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- XsdDateTime.cs
- KeyValueConfigurationElement.cs
- DocumentCollection.cs
- UInt32Converter.cs
- AuthorizationSection.cs
- IndexedEnumerable.cs
- InputReportEventArgs.cs
- SynchronizationContext.cs
- SafeFindHandle.cs
- ColorInterpolationModeValidation.cs
- NativeMethods.cs
- DiagnosticSection.cs
- GeometryHitTestResult.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- DataObjectMethodAttribute.cs
- UInt32.cs
- AliasExpr.cs
- DrawingAttributesDefaultValueFactory.cs
- RuntimeConfigurationRecord.cs
- MultipleViewPattern.cs
- RawMouseInputReport.cs
- DistributedTransactionPermission.cs
- ExternalCalls.cs
- IConvertible.cs
- UIElement.cs
- ProcessHostConfigUtils.cs
- FileLogRecord.cs
- ConnectionPoint.cs
- Dynamic.cs
- CompositeCollectionView.cs
- MobileContainerDesigner.cs
- SerialPinChanges.cs
- DataTemplate.cs
- XmlElement.cs
- ToolboxDataAttribute.cs
- StylusCollection.cs
- PartitionedStream.cs
- SecurityAccessDeniedException.cs
- mediaeventargs.cs
- ClientRuntime.cs
- Odbc32.cs
- LocalizableResourceBuilder.cs
- CodeSpit.cs
- DefaultParameterValueAttribute.cs
- RegistryPermission.cs
- ThemeDirectoryCompiler.cs
- SqlInternalConnection.cs
- TextWriter.cs
- BitmapMetadataEnumerator.cs
- processwaithandle.cs
- FigureParagraph.cs
- ModelPropertyDescriptor.cs
- DateTimeFormat.cs
- PathFigureCollectionConverter.cs
- TimersDescriptionAttribute.cs
- UpdateTranslator.cs
- ConfigUtil.cs
- FontResourceCache.cs
- SqlInternalConnection.cs
- TileModeValidation.cs
- TransformerTypeCollection.cs
- CrossSiteScriptingValidation.cs
- SystemMulticastIPAddressInformation.cs
- LinqDataSourceView.cs
- AQNBuilder.cs
- TypeUsageBuilder.cs
- ProgressiveCrcCalculatingStream.cs
- TriState.cs
- HttpProtocolReflector.cs
- HtmlWindow.cs
- ResXBuildProvider.cs
- NameSpaceExtractor.cs
- WebDescriptionAttribute.cs
- AutomationIdentifierGuids.cs
- SimpleTypesSurrogate.cs
- AssemblyHash.cs
- CssClassPropertyAttribute.cs
- InstanceView.cs
- ServiceNameElement.cs
- ValueChangedEventManager.cs
- FormatVersion.cs
- ToolStripDropDownClosedEventArgs.cs
- _Win32.cs
- NullExtension.cs
- DataStreams.cs
- ResourceDescriptionAttribute.cs
- HttpModuleCollection.cs
- TagPrefixCollection.cs
- EncodingStreamWrapper.cs
- FontFamily.cs
- TransformCollection.cs
- XsltSettings.cs
- MutexSecurity.cs
- OleDbRowUpdatingEvent.cs
- FormsAuthenticationTicket.cs
- PerformanceCountersElement.cs