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
- StringHelper.cs
- BaseResourcesBuildProvider.cs
- ReachSerializationUtils.cs
- BitmapPalette.cs
- FixedDocumentSequencePaginator.cs
- OptionalMessageQuery.cs
- SchemaInfo.cs
- KeyedHashAlgorithm.cs
- SqlExpressionNullability.cs
- GridView.cs
- DataRelationCollection.cs
- BrowserCapabilitiesFactoryBase.cs
- Condition.cs
- CommentEmitter.cs
- FontStretches.cs
- Point3DKeyFrameCollection.cs
- Base64WriteStateInfo.cs
- XomlCompilerHelpers.cs
- _TimerThread.cs
- ForeignKeyConstraint.cs
- DateTimeConverter2.cs
- Compilation.cs
- StatusBar.cs
- CryptoProvider.cs
- CompositeFontParser.cs
- Single.cs
- ListenerConnectionModeReader.cs
- BuildProvidersCompiler.cs
- DesignerAttributeInfo.cs
- grammarelement.cs
- QueryLifecycle.cs
- HttpDictionary.cs
- Menu.cs
- Stacktrace.cs
- XmlSchemaException.cs
- Stack.cs
- VectorConverter.cs
- UnaryNode.cs
- TypeConvertions.cs
- OutputCacheSettings.cs
- SoapAttributes.cs
- bidPrivateBase.cs
- StylusButtonEventArgs.cs
- Normalization.cs
- _SecureChannel.cs
- RegexBoyerMoore.cs
- CommandHelper.cs
- WebRequestModuleElement.cs
- SymbolType.cs
- DataKey.cs
- RelatedCurrencyManager.cs
- HeaderElement.cs
- Point3D.cs
- ProtectedConfigurationSection.cs
- ExternalDataExchangeClient.cs
- ResourceManager.cs
- QilGenerator.cs
- Ref.cs
- Iis7Helper.cs
- FileAuthorizationModule.cs
- Geometry3D.cs
- ReadOnlyDataSource.cs
- Decimal.cs
- ReliableOutputConnection.cs
- DbDataReader.cs
- Soap12ProtocolImporter.cs
- EntityDataSourceView.cs
- httpserverutility.cs
- DynamicObject.cs
- GPPOINTF.cs
- Visitors.cs
- PeerResolverSettings.cs
- OleDbWrapper.cs
- PackageRelationshipCollection.cs
- ComponentResourceManager.cs
- OleAutBinder.cs
- ByteFacetDescriptionElement.cs
- BitmapFrameEncode.cs
- ButtonStandardAdapter.cs
- TabControlAutomationPeer.cs
- RemotingException.cs
- ProcessHostMapPath.cs
- IInstanceTable.cs
- XmlChoiceIdentifierAttribute.cs
- SafeSystemMetrics.cs
- COMException.cs
- PageBreakRecord.cs
- WpfKnownMember.cs
- ProtocolElement.cs
- BordersPage.cs
- JoinTreeSlot.cs
- SocketElement.cs
- DefaultTraceListener.cs
- SessionPageStatePersister.cs
- XMLSchema.cs
- Stylesheet.cs
- Timer.cs
- HotSpot.cs
- CultureSpecificCharacterBufferRange.cs
- BitmapEffectGeneralTransform.cs