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
- RtType.cs
- SecUtil.cs
- Stopwatch.cs
- SelfSignedCertificate.cs
- ConstructorExpr.cs
- GridItem.cs
- GPPOINT.cs
- GroupQuery.cs
- Renderer.cs
- ClientSideProviderDescription.cs
- ViewRendering.cs
- MimeTextImporter.cs
- Separator.cs
- serverconfig.cs
- XmlSerializerAssemblyAttribute.cs
- LogLogRecordHeader.cs
- HttpModulesSection.cs
- StructuralType.cs
- BindingContext.cs
- GenericUriParser.cs
- MetadataItemEmitter.cs
- JsonQueryStringConverter.cs
- SystemIPv6InterfaceProperties.cs
- OdbcConnectionStringbuilder.cs
- CircleHotSpot.cs
- EventlogProvider.cs
- TrackingRecordPreFilter.cs
- EdmSchemaError.cs
- PerformanceCounterLib.cs
- BasicExpressionVisitor.cs
- EntityReference.cs
- ComponentEvent.cs
- PassportAuthenticationEventArgs.cs
- sapiproxy.cs
- ContainerSelectorBehavior.cs
- HttpException.cs
- AggregateException.cs
- UidPropertyAttribute.cs
- SqlDataReaderSmi.cs
- AttachedAnnotation.cs
- Keywords.cs
- BindingParameterCollection.cs
- MissingSatelliteAssemblyException.cs
- HttpHandlersSection.cs
- OpCodes.cs
- DesigntimeLicenseContext.cs
- AppearanceEditorPart.cs
- NamespaceQuery.cs
- GenericTextProperties.cs
- XsdDateTime.cs
- DataContractSerializer.cs
- EndpointDispatcher.cs
- SystemInfo.cs
- SafeLocalMemHandle.cs
- WindowsFormsDesignerOptionService.cs
- DataGridrowEditEndingEventArgs.cs
- PointLightBase.cs
- KeyboardDevice.cs
- IBuiltInEvidence.cs
- RelatedImageListAttribute.cs
- SyndicationSerializer.cs
- BindingContext.cs
- ContextStaticAttribute.cs
- DataContractSerializerOperationFormatter.cs
- VoiceSynthesis.cs
- OracleFactory.cs
- SrgsOneOf.cs
- ManifestResourceInfo.cs
- ForceCopyBuildProvider.cs
- VirtualPath.cs
- XmlSchemaExternal.cs
- Attribute.cs
- DodSequenceMerge.cs
- HttpServerChannel.cs
- SimpleHandlerFactory.cs
- WebPartZoneBase.cs
- IResourceProvider.cs
- Transform3DCollection.cs
- ComplexType.cs
- ErrorReporting.cs
- GACIdentityPermission.cs
- XmlCharacterData.cs
- XamlReaderHelper.cs
- AssociatedControlConverter.cs
- WindowsStartMenu.cs
- XPathArrayIterator.cs
- ThreadSafeList.cs
- CollectionDataContract.cs
- SendActivityDesigner.cs
- TableLayout.cs
- UrlRoutingHandler.cs
- InternalConfigRoot.cs
- SpeechEvent.cs
- WorkflowMarkupSerializationProvider.cs
- AccessorTable.cs
- TransportOutputChannel.cs
- TransformerConfigurationWizardBase.cs
- ModelItemExtensions.cs
- SmtpCommands.cs
- TcpProcessProtocolHandler.cs