Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- AttributeEmitter.cs
- infer.cs
- SqlTrackingWorkflowInstance.cs
- BigInt.cs
- ReflectEventDescriptor.cs
- mediaeventshelper.cs
- ContractMapping.cs
- Quaternion.cs
- TextFormatterContext.cs
- EmptyCollection.cs
- ItemsPresenter.cs
- PolicyManager.cs
- SmtpSection.cs
- Block.cs
- SmiEventSink_Default.cs
- ToolboxComponentsCreatingEventArgs.cs
- SharedPersonalizationStateInfo.cs
- DatagridviewDisplayedBandsData.cs
- SiteMapSection.cs
- WindowsProgressbar.cs
- ToolStripContentPanelRenderEventArgs.cs
- JournalEntry.cs
- OdbcConnectionOpen.cs
- BorderGapMaskConverter.cs
- ListItemCollection.cs
- Label.cs
- Dictionary.cs
- List.cs
- XmlSchemaInferenceException.cs
- XamlWrappingReader.cs
- TextTreeInsertElementUndoUnit.cs
- smtpconnection.cs
- DrawingImage.cs
- ClientEventManager.cs
- GenericRootAutomationPeer.cs
- ExpressionBindingCollection.cs
- ObjectDisposedException.cs
- BasicSecurityProfileVersion.cs
- LoginUtil.cs
- XamlSerializerUtil.cs
- TransactionOptions.cs
- FontSource.cs
- GridItemCollection.cs
- CodeIdentifier.cs
- ScriptRegistrationManager.cs
- Vector3DCollectionConverter.cs
- XmlSiteMapProvider.cs
- EmptyEnumerable.cs
- Parameter.cs
- FixedSOMLineRanges.cs
- ResourceSet.cs
- ConfigurationStrings.cs
- RectAnimationUsingKeyFrames.cs
- Permission.cs
- ObfuscateAssemblyAttribute.cs
- SizeIndependentAnimationStorage.cs
- PolyQuadraticBezierSegment.cs
- ActivityDesignerResources.cs
- WmlValidationSummaryAdapter.cs
- TreeIterator.cs
- WebBrowserUriTypeConverter.cs
- ListViewUpdateEventArgs.cs
- AliasGenerator.cs
- PersonalizationProviderHelper.cs
- IList.cs
- SpStreamWrapper.cs
- DecimalKeyFrameCollection.cs
- KeyFrames.cs
- RSAPKCS1SignatureDeformatter.cs
- SocketAddress.cs
- IsolationInterop.cs
- COM2IDispatchConverter.cs
- __TransparentProxy.cs
- DataSvcMapFile.cs
- columnmapkeybuilder.cs
- DtdParser.cs
- CharacterMetrics.cs
- ClientFormsIdentity.cs
- BaseParaClient.cs
- SplineKeyFrames.cs
- CompressionTransform.cs
- ConsoleTraceListener.cs
- PropertyEmitter.cs
- CodeGeneratorAttribute.cs
- ObjectMaterializedEventArgs.cs
- SqlDataSource.cs
- SerializationEventsCache.cs
- BlurEffect.cs
- Codec.cs
- WizardStepBase.cs
- NodeFunctions.cs
- SharedMemory.cs
- BulletDecorator.cs
- SparseMemoryStream.cs
- localization.cs
- WebPartVerbCollection.cs
- XmlnsCompatibleWithAttribute.cs
- SecurityElement.cs
- WorkflowOperationErrorHandler.cs
- DnsElement.cs