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
- Pen.cs
- _TimerThread.cs
- DependencyPropertyChangedEventArgs.cs
- _CookieModule.cs
- Rectangle.cs
- DataGridViewCellValidatingEventArgs.cs
- TextSelectionProcessor.cs
- DataGridViewCellCollection.cs
- AtomEntry.cs
- TabControl.cs
- RegexParser.cs
- QuotedPrintableStream.cs
- SelectedPathEditor.cs
- RequiredFieldValidator.cs
- StrokeRenderer.cs
- ObjectParameter.cs
- TrackingServices.cs
- Registry.cs
- VBIdentifierName.cs
- HiddenField.cs
- UidManager.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- RuntimeEnvironment.cs
- DesignerAttribute.cs
- RotateTransform3D.cs
- OdbcConnectionString.cs
- TickBar.cs
- ResourceDisplayNameAttribute.cs
- GeneralTransformGroup.cs
- NavigationHelper.cs
- CompilerCollection.cs
- PrimarySelectionAdorner.cs
- CodeSnippetExpression.cs
- Menu.cs
- CollectionBase.cs
- CachedBitmap.cs
- UnsafeNativeMethods.cs
- IdentityReference.cs
- SimpleParser.cs
- UserInitiatedRoutedEventPermission.cs
- SqlDependency.cs
- SafeArrayRankMismatchException.cs
- SqlConnectionManager.cs
- DocumentEventArgs.cs
- HttpResponseHeader.cs
- DataBinding.cs
- BatchParser.cs
- UpdatableWrapper.cs
- LinearQuaternionKeyFrame.cs
- PrintingPermissionAttribute.cs
- SystemInformation.cs
- ThicknessAnimationBase.cs
- SchemaNames.cs
- CodeArgumentReferenceExpression.cs
- ManifestSignatureInformation.cs
- BitArray.cs
- TraceListeners.cs
- DataReaderContainer.cs
- Boolean.cs
- OptimalBreakSession.cs
- OutgoingWebRequestContext.cs
- ServiceMetadataContractBehavior.cs
- RunInstallerAttribute.cs
- RepeatButtonAutomationPeer.cs
- HMACSHA512.cs
- DynamicExpression.cs
- DoubleAnimationUsingPath.cs
- NoneExcludedImageIndexConverter.cs
- ETagAttribute.cs
- SoapAttributeAttribute.cs
- _OverlappedAsyncResult.cs
- DoubleCollectionConverter.cs
- Rethrow.cs
- AstNode.cs
- RequestBringIntoViewEventArgs.cs
- PrintPreviewControl.cs
- ButtonPopupAdapter.cs
- ResponseStream.cs
- MobileCapabilities.cs
- ButtonAutomationPeer.cs
- SharedUtils.cs
- Ops.cs
- HttpModulesSection.cs
- DefaultValueTypeConverter.cs
- Partitioner.cs
- PropertyMappingExceptionEventArgs.cs
- MarkedHighlightComponent.cs
- ExtensionSimplifierMarkupObject.cs
- ElementNotAvailableException.cs
- DispatchChannelSink.cs
- CodeMethodMap.cs
- NamespaceDecl.cs
- TypeElementCollection.cs
- FontInfo.cs
- SqlError.cs
- Debugger.cs
- RegexCode.cs
- ScrollBarAutomationPeer.cs
- Funcletizer.cs
- Converter.cs