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
- HistoryEventArgs.cs
- ToolboxItemCollection.cs
- DynamicActivityTypeDescriptor.cs
- InvalidComObjectException.cs
- LicenseException.cs
- ApplicationHost.cs
- BufferedStream.cs
- Sql8ExpressionRewriter.cs
- AuthenticationModuleElementCollection.cs
- HttpHandlersSection.cs
- CompilerResults.cs
- MouseOverProperty.cs
- XmlQualifiedName.cs
- WsatStrings.cs
- ParseHttpDate.cs
- Validator.cs
- MulticastIPAddressInformationCollection.cs
- DataViewManager.cs
- ExecutionEngineException.cs
- StringDictionary.cs
- errorpatternmatcher.cs
- CopyAttributesAction.cs
- ObjectCloneHelper.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- FastEncoderStatics.cs
- SQLBytesStorage.cs
- PropertyFilterAttribute.cs
- TextDecorationUnitValidation.cs
- Win32PrintDialog.cs
- DummyDataSource.cs
- ElementUtil.cs
- LingerOption.cs
- ApplicationCommands.cs
- DataKey.cs
- CodePrimitiveExpression.cs
- ping.cs
- TextEditorLists.cs
- IdleTimeoutMonitor.cs
- Vector3D.cs
- XmlDocument.cs
- Calendar.cs
- ValidationSummary.cs
- DocumentApplicationJournalEntryEventArgs.cs
- SequentialOutput.cs
- DataSetMappper.cs
- MetaType.cs
- ComAwareEventInfo.cs
- UnSafeCharBuffer.cs
- FileUpload.cs
- MatrixUtil.cs
- DSACryptoServiceProvider.cs
- ProxyWebPartManager.cs
- DesignOnlyAttribute.cs
- ContentControl.cs
- StoreItemCollection.cs
- RepeaterItem.cs
- LogRecordSequence.cs
- DependencyPropertyHelper.cs
- PlatformNotSupportedException.cs
- DocumentPageView.cs
- ReadWriteObjectLock.cs
- DeviceFilterEditorDialog.cs
- CheckBoxBaseAdapter.cs
- FixedSOMImage.cs
- ImageCodecInfoPrivate.cs
- BitmapMetadata.cs
- AutomationProperties.cs
- XmlSchemaSimpleTypeRestriction.cs
- StrongTypingException.cs
- Messages.cs
- SchemaSetCompiler.cs
- ProcessStartInfo.cs
- CheckBoxStandardAdapter.cs
- ParsedAttributeCollection.cs
- ProfilePropertyMetadata.cs
- Base64Encoding.cs
- FilteredAttributeCollection.cs
- ValidationPropertyAttribute.cs
- HttpPostedFile.cs
- MailSettingsSection.cs
- WebSysDisplayNameAttribute.cs
- CompiledRegexRunner.cs
- XmlNavigatorStack.cs
- CachedBitmap.cs
- Comparer.cs
- XmlComplianceUtil.cs
- DictionarySectionHandler.cs
- FontNameConverter.cs
- TableLayout.cs
- CodeArrayCreateExpression.cs
- DataGridAutoFormat.cs
- DelimitedListTraceListener.cs
- DataObjectAttribute.cs
- PageCache.cs
- DataBoundLiteralControl.cs
- EntityProviderFactory.cs
- TabletCollection.cs
- BuildManagerHost.cs
- Camera.cs
- SpotLight.cs