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
- DataSourceComponent.cs
- ProcessModuleCollection.cs
- DocumentViewerConstants.cs
- EventMappingSettingsCollection.cs
- CachedTypeface.cs
- Vector3D.cs
- SoapSchemaImporter.cs
- DataTransferEventArgs.cs
- ConfigXmlComment.cs
- Point3DAnimationBase.cs
- PingOptions.cs
- XmlChildEnumerator.cs
- QilScopedVisitor.cs
- UnsafeNativeMethods.cs
- SystemThemeKey.cs
- VectorCollectionValueSerializer.cs
- AnnotationObservableCollection.cs
- BooleanProjectedSlot.cs
- CodeMemberEvent.cs
- WindowsSolidBrush.cs
- DesignerListAdapter.cs
- X509KeyIdentifierClauseType.cs
- UdpRetransmissionSettings.cs
- TransformConverter.cs
- MimeMapping.cs
- FixedTextBuilder.cs
- AsymmetricAlgorithm.cs
- SingleObjectCollection.cs
- TcpAppDomainProtocolHandler.cs
- Vector3DAnimationBase.cs
- KnownAssemblyEntry.cs
- TextProviderWrapper.cs
- ExceptionUtility.cs
- Assembly.cs
- ObjectStateManagerMetadata.cs
- OleDbWrapper.cs
- messageonlyhwndwrapper.cs
- ListManagerBindingsCollection.cs
- KeyedHashAlgorithm.cs
- ProfilePropertyNameValidator.cs
- DbgUtil.cs
- WpfSharedXamlSchemaContext.cs
- DateTimeConstantAttribute.cs
- TableMethodGenerator.cs
- DropSource.cs
- RequestCachingSection.cs
- XmlSchemas.cs
- TrustDriver.cs
- NavigationWindow.cs
- _LocalDataStore.cs
- WsatRegistrationHeader.cs
- XmlSerializerSection.cs
- HttpRuntimeSection.cs
- PerfCounterSection.cs
- WebFaultClientMessageInspector.cs
- ClientFormsAuthenticationCredentials.cs
- SizeAnimationClockResource.cs
- GCHandleCookieTable.cs
- StrokeCollectionDefaultValueFactory.cs
- XmlValueConverter.cs
- CodeGen.cs
- AssemblyName.cs
- PublisherIdentityPermission.cs
- XXXOnTypeBuilderInstantiation.cs
- InternalConfigSettingsFactory.cs
- SchemaNames.cs
- NumericExpr.cs
- ClockController.cs
- SoapHelper.cs
- ComEventsHelper.cs
- HtmlUtf8RawTextWriter.cs
- DesignerListAdapter.cs
- ClrPerspective.cs
- IgnoreSection.cs
- SimpleHandlerBuildProvider.cs
- ConstantProjectedSlot.cs
- DataGridViewRowHeaderCell.cs
- DataGridViewEditingControlShowingEventArgs.cs
- AdRotatorDesigner.cs
- Listbox.cs
- AssociationTypeEmitter.cs
- DirectionalLight.cs
- DataGridViewAddColumnDialog.cs
- BaseServiceProvider.cs
- RangeExpression.cs
- FrameworkTextComposition.cs
- SqlStatistics.cs
- WebPartMenuStyle.cs
- Int32.cs
- DebugHandleTracker.cs
- ApplicationActivator.cs
- CompositionAdorner.cs
- ContractHandle.cs
- MaterialCollection.cs
- SmtpCommands.cs
- WaitHandle.cs
- UpdateEventArgs.cs
- basecomparevalidator.cs
- ListControl.cs
- Material.cs