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
- Viewport3DAutomationPeer.cs
- AsyncContentLoadedEventArgs.cs
- ExtenderControl.cs
- SQLDecimalStorage.cs
- IndentedWriter.cs
- SolidColorBrush.cs
- ActivityScheduledRecord.cs
- RepeatInfo.cs
- WorkflowValidationFailedException.cs
- TreeNodeStyle.cs
- GeneralTransform.cs
- DesignerTextBoxAdapter.cs
- ColumnHeaderConverter.cs
- _Win32.cs
- PrinterUnitConvert.cs
- SecureStringHasher.cs
- WorkflowItemPresenter.cs
- ImportRequest.cs
- IDataContractSurrogate.cs
- InkSerializer.cs
- ApplicationBuildProvider.cs
- Semaphore.cs
- XMLSyntaxException.cs
- ParameterBuilder.cs
- MappingSource.cs
- SoapExtensionStream.cs
- CodeTypeDeclarationCollection.cs
- SurrogateEncoder.cs
- ChameleonKey.cs
- _DigestClient.cs
- SafeRightsManagementEnvironmentHandle.cs
- ConfigurationValidatorAttribute.cs
- OutputCacheProfileCollection.cs
- ScriptMethodAttribute.cs
- DefaultSerializationProviderAttribute.cs
- BoundingRectTracker.cs
- DescendantBaseQuery.cs
- HttpHandlerAction.cs
- TypeUnloadedException.cs
- TargetFrameworkUtil.cs
- MSAAEventDispatcher.cs
- EntityDataSourceColumn.cs
- FontStretch.cs
- VirtualizingStackPanel.cs
- QueryExecutionOption.cs
- AppDomainAttributes.cs
- SecurityUtils.cs
- WebBrowserPermission.cs
- TailCallAnalyzer.cs
- FastEncoderWindow.cs
- ScriptReference.cs
- DifferencingCollection.cs
- CharAnimationUsingKeyFrames.cs
- DetailsViewRow.cs
- SqlUtils.cs
- _SSPIWrapper.cs
- ReferencedCollectionType.cs
- ExpressionBuilder.cs
- MessagePropertyVariants.cs
- DataGridViewIntLinkedList.cs
- TimeSpanStorage.cs
- MultiTargetingUtil.cs
- PanelDesigner.cs
- MimeParameter.cs
- ProcessModelSection.cs
- SqlNotificationRequest.cs
- CultureTable.cs
- ControlParameter.cs
- SessionEndedEventArgs.cs
- ActivityCollectionMarkupSerializer.cs
- SqlDataSourceFilteringEventArgs.cs
- HttpProtocolReflector.cs
- ParameterBuilder.cs
- DataTableNewRowEvent.cs
- Semaphore.cs
- AsymmetricCryptoHandle.cs
- PatternMatcher.cs
- ResourcesChangeInfo.cs
- XmlValidatingReader.cs
- OpenTypeLayoutCache.cs
- JoinCqlBlock.cs
- HelpInfo.cs
- GridViewSelectEventArgs.cs
- RIPEMD160Managed.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- Animatable.cs
- StyleReferenceConverter.cs
- StateManagedCollection.cs
- LocationReferenceValue.cs
- GenerateTemporaryTargetAssembly.cs
- TrustManagerMoreInformation.cs
- _SpnDictionary.cs
- AspNetSynchronizationContext.cs
- URL.cs
- ThicknessConverter.cs
- DragAssistanceManager.cs
- GridViewDeletedEventArgs.cs
- XmlKeywords.cs
- path.cs
- SimpleLine.cs