Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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); } } } // 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; 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); } } } // 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
- MailBnfHelper.cs
- PointCollection.cs
- FactoryMaker.cs
- ServicesExceptionNotHandledEventArgs.cs
- MdiWindowListStrip.cs
- ApplicationServicesHostFactory.cs
- File.cs
- OutputCacheProfile.cs
- DetailsViewDeleteEventArgs.cs
- XmlTextReaderImplHelpers.cs
- Internal.cs
- PartialTrustHelpers.cs
- IgnoreSectionHandler.cs
- SafeWaitHandle.cs
- RouteItem.cs
- Int32KeyFrameCollection.cs
- unsafenativemethodsother.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- httpserverutility.cs
- LogStream.cs
- StateDesigner.CommentLayoutGlyph.cs
- MatrixTransform3D.cs
- MessageQueuePermissionAttribute.cs
- ModuleBuilderData.cs
- PeerNode.cs
- DataGridViewColumnEventArgs.cs
- LambdaCompiler.Lambda.cs
- GridItem.cs
- BrowserCapabilitiesCompiler.cs
- GeometryValueSerializer.cs
- Underline.cs
- DispatcherObject.cs
- EmptyStringExpandableObjectConverter.cs
- ObservableDictionary.cs
- FormatSettings.cs
- GuidConverter.cs
- StorageAssociationTypeMapping.cs
- thaishape.cs
- DiscoveryDocumentSearchPattern.cs
- SchemaSetCompiler.cs
- TabItemWrapperAutomationPeer.cs
- RequestBringIntoViewEventArgs.cs
- GroupLabel.cs
- DataListItemEventArgs.cs
- SessionEndingEventArgs.cs
- SpellerHighlightLayer.cs
- FloaterParaClient.cs
- CriticalExceptions.cs
- ProgressChangedEventArgs.cs
- AvtEvent.cs
- GestureRecognitionResult.cs
- BulletDecorator.cs
- TopClause.cs
- PeerNameRegistration.cs
- SafeUserTokenHandle.cs
- ByteStack.cs
- IPAddress.cs
- MasterPageCodeDomTreeGenerator.cs
- BookmarkManager.cs
- DbXmlEnabledProviderManifest.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- MatrixCamera.cs
- DefaultClaimSet.cs
- WindowsImpersonationContext.cs
- CheckoutException.cs
- StringCollection.cs
- PenThreadWorker.cs
- Line.cs
- StringStorage.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- XamlSerializerUtil.cs
- WSFederationHttpSecurity.cs
- Int16Converter.cs
- MatcherBuilder.cs
- smtppermission.cs
- TextParagraph.cs
- RadioButton.cs
- DataErrorValidationRule.cs
- InstanceDataCollectionCollection.cs
- StrokeNodeOperations.cs
- SqlDataSourceConfigureSortForm.cs
- BufferAllocator.cs
- FamilyTypefaceCollection.cs
- DataGridViewCellMouseEventArgs.cs
- UnauthorizedWebPart.cs
- FragmentQueryProcessor.cs
- sqlstateclientmanager.cs
- HMAC.cs
- DataViewManagerListItemTypeDescriptor.cs
- WebPartMovingEventArgs.cs
- WebPartCatalogAddVerb.cs
- Quaternion.cs
- Marshal.cs
- ToolBar.cs
- ExcludePathInfo.cs
- SecondaryIndexList.cs
- FrameworkContentElement.cs
- ColumnClickEvent.cs
- ValidationHelper.cs
- Content.cs