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
- ObjectListTitleAttribute.cs
- CalculatedColumn.cs
- wgx_sdk_version.cs
- ControlUtil.cs
- DbConvert.cs
- XmlSequenceWriter.cs
- XmlProcessingInstruction.cs
- RichTextBox.cs
- Double.cs
- DbInsertCommandTree.cs
- ButtonRenderer.cs
- DbProviderConfigurationHandler.cs
- Vector3D.cs
- CssClassPropertyAttribute.cs
- XmlElementCollection.cs
- FormatterConverter.cs
- IDispatchConstantAttribute.cs
- NonVisualControlAttribute.cs
- AdapterUtil.cs
- DbParameterCollectionHelper.cs
- ComUdtElementCollection.cs
- DataBoundLiteralControl.cs
- XmlToDatasetMap.cs
- BinHexDecoder.cs
- EDesignUtil.cs
- ScaleTransform.cs
- SQLGuid.cs
- MsmqIntegrationProcessProtocolHandler.cs
- SafeSecurityHelper.cs
- SqlVisitor.cs
- OdbcReferenceCollection.cs
- ScaleTransform.cs
- CriticalHandle.cs
- DataObjectPastingEventArgs.cs
- PenContexts.cs
- ElementMarkupObject.cs
- AutomationProperties.cs
- PipelineModuleStepContainer.cs
- ContextMarshalException.cs
- SerializableAttribute.cs
- Operand.cs
- MouseActionConverter.cs
- MatrixTransform.cs
- SqlBulkCopy.cs
- MimeMapping.cs
- WindowAutomationPeer.cs
- DbSetClause.cs
- CodeArrayIndexerExpression.cs
- CatalogPart.cs
- ContextProperty.cs
- DataGrid.cs
- ManifestResourceInfo.cs
- DockAndAnchorLayout.cs
- ForceCopyBuildProvider.cs
- ObjectDataSourceStatusEventArgs.cs
- SecurityPermission.cs
- SlipBehavior.cs
- EUCJPEncoding.cs
- GetRecipientRequest.cs
- ThicknessKeyFrameCollection.cs
- DispatcherFrame.cs
- FrameworkTemplate.cs
- CustomAttributeFormatException.cs
- WebPartsPersonalizationAuthorization.cs
- AlignmentYValidation.cs
- ScriptingAuthenticationServiceSection.cs
- EventTrigger.cs
- BrowserTree.cs
- CommonGetThemePartSize.cs
- SwitchAttribute.cs
- EventData.cs
- SubMenuStyle.cs
- Expression.cs
- BinaryMessageEncodingElement.cs
- DependencyPropertyDescriptor.cs
- PriorityBinding.cs
- EdmItemError.cs
- SortKey.cs
- HtmlTextBoxAdapter.cs
- DiscoveryUtility.cs
- CorrelationManager.cs
- ServiceReference.cs
- CompensationDesigner.cs
- SessionIDManager.cs
- Int64Converter.cs
- InputGestureCollection.cs
- DateTimeOffsetAdapter.cs
- DataTableCollection.cs
- IgnoreFlushAndCloseStream.cs
- KeyTimeConverter.cs
- FormViewModeEventArgs.cs
- FontDifferentiator.cs
- Keywords.cs
- ThicknessAnimationUsingKeyFrames.cs
- DelegateTypeInfo.cs
- PrintControllerWithStatusDialog.cs
- TableFieldsEditor.cs
- TextShapeableCharacters.cs
- Translator.cs
- SmuggledIUnknown.cs