Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LOSFormatter.cs
- MatrixAnimationUsingPath.cs
- DataGridHeaderBorder.cs
- LinkTarget.cs
- StorageEntityTypeMapping.cs
- WorkflowRuntimeService.cs
- SetStoryboardSpeedRatio.cs
- HostUtils.cs
- DataMisalignedException.cs
- AttachedAnnotationChangedEventArgs.cs
- Token.cs
- BaseTemplateCodeDomTreeGenerator.cs
- FolderBrowserDialog.cs
- InternalReceiveMessage.cs
- ScrollItemProviderWrapper.cs
- ValidationEventArgs.cs
- Dump.cs
- SeverityFilter.cs
- IdnElement.cs
- EntityProxyFactory.cs
- BamlLocalizer.cs
- ParameterElement.cs
- ProtectedConfigurationProviderCollection.cs
- TableLayoutColumnStyleCollection.cs
- SoapAttributes.cs
- DrawItemEvent.cs
- SchemaNamespaceManager.cs
- ScriptControlDescriptor.cs
- CodeConditionStatement.cs
- StringExpressionSet.cs
- RegexCapture.cs
- IndexedGlyphRun.cs
- RelationshipEnd.cs
- WindowsGrip.cs
- HandlerBase.cs
- ExpressionNormalizer.cs
- ObjectQuery_EntitySqlExtensions.cs
- Formatter.cs
- WhitespaceSignificantCollectionAttribute.cs
- MailMessageEventArgs.cs
- ConvertersCollection.cs
- SortFieldComparer.cs
- IResourceProvider.cs
- ObjectDataSourceView.cs
- Latin1Encoding.cs
- XmlNotation.cs
- IPHostEntry.cs
- TableItemPattern.cs
- SessionEndingCancelEventArgs.cs
- KeyValuePair.cs
- AutomationElement.cs
- Globals.cs
- Util.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- columnmapkeybuilder.cs
- Container.cs
- CatalogPartChrome.cs
- QueryPageSettingsEventArgs.cs
- RedirectionProxy.cs
- DatePickerTextBox.cs
- NavigationEventArgs.cs
- VisualTreeHelper.cs
- TimeStampChecker.cs
- HandoffBehavior.cs
- IndexerNameAttribute.cs
- TextRangeEditTables.cs
- DataGridSortCommandEventArgs.cs
- CompilerScopeManager.cs
- ValidatingReaderNodeData.cs
- InputReferenceExpression.cs
- Substitution.cs
- WorkflowViewManager.cs
- DllNotFoundException.cs
- ResolveDuplexAsyncResult.cs
- MemberExpressionHelper.cs
- XmlExtensionFunction.cs
- DragSelectionMessageFilter.cs
- NullableDecimalMinMaxAggregationOperator.cs
- UIElementParagraph.cs
- UriTemplateCompoundPathSegment.cs
- RemotingAttributes.cs
- Int32AnimationUsingKeyFrames.cs
- WindowsGraphics.cs
- UncommonField.cs
- SerializationHelper.cs
- WindowsScroll.cs
- EntityReference.cs
- WebPartDeleteVerb.cs
- DataGridRowEventArgs.cs
- TraceEventCache.cs
- Profiler.cs
- SignatureHelper.cs
- MoveSizeWinEventHandler.cs
- PocoEntityKeyStrategy.cs
- DataGridPreparingCellForEditEventArgs.cs
- HwndPanningFeedback.cs
- NativeMethodsCLR.cs
- ImageSource.cs
- ListDictionaryInternal.cs
- EmptyCollection.cs