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
- BufferModesCollection.cs
- SQLStringStorage.cs
- WebPartConnectionsConfigureVerb.cs
- SpecularMaterial.cs
- EastAsianLunisolarCalendar.cs
- CodeDOMProvider.cs
- SqlTriggerContext.cs
- WebResourceAttribute.cs
- PenContext.cs
- GenericUriParser.cs
- ToolTipService.cs
- XmlArrayAttribute.cs
- Vector3DIndependentAnimationStorage.cs
- TypeForwardedFromAttribute.cs
- DaylightTime.cs
- PerformanceCounterPermissionEntry.cs
- DoubleAnimationUsingKeyFrames.cs
- COMException.cs
- Span.cs
- CodeStatement.cs
- ResourceDisplayNameAttribute.cs
- RegionIterator.cs
- NetworkAddressChange.cs
- ContractsBCL.cs
- ServiceOperationWrapper.cs
- HexParser.cs
- SchemaImporter.cs
- DataColumnChangeEvent.cs
- FrameworkElementFactoryMarkupObject.cs
- XhtmlBasicLabelAdapter.cs
- SystemResourceHost.cs
- XmlQueryCardinality.cs
- SelfIssuedAuthAsymmetricKey.cs
- DataPagerCommandEventArgs.cs
- PageBuildProvider.cs
- HwndTarget.cs
- PropertyCollection.cs
- StylusPointPropertyInfoDefaults.cs
- ObjectContext.cs
- XmlTypeMapping.cs
- TextDecorations.cs
- TimeSpanOrInfiniteValidator.cs
- AdRotatorDesigner.cs
- DataServiceQueryProvider.cs
- SmiRequestExecutor.cs
- BackStopAuthenticationModule.cs
- SvcMapFile.cs
- FlowLayout.cs
- ObjectCache.cs
- DataDesignUtil.cs
- ListViewItem.cs
- OutputCacheModule.cs
- OracleMonthSpan.cs
- LogSwitch.cs
- CodeGenerator.cs
- Transform3DGroup.cs
- EmbeddedObject.cs
- Exceptions.cs
- InstallerTypeAttribute.cs
- Vector3D.cs
- BitmapImage.cs
- ScaleTransform3D.cs
- CommandValueSerializer.cs
- SponsorHelper.cs
- HostingEnvironment.cs
- XmlCharCheckingReader.cs
- LinkUtilities.cs
- TimeSpanValidator.cs
- WindowsAuthenticationEventArgs.cs
- ImplicitInputBrush.cs
- documentation.cs
- ReplacementText.cs
- ClosableStream.cs
- GeometryModel3D.cs
- OdbcHandle.cs
- TableProviderWrapper.cs
- CLRBindingWorker.cs
- BitmapSourceSafeMILHandle.cs
- BitmapEffectOutputConnector.cs
- ColumnResult.cs
- RSAOAEPKeyExchangeDeformatter.cs
- GridViewAutomationPeer.cs
- DataSourceCache.cs
- DataRow.cs
- PipelineModuleStepContainer.cs
- RayMeshGeometry3DHitTestResult.cs
- ServiceDescription.cs
- DynamicValidator.cs
- XpsException.cs
- TdsParserStateObject.cs
- HealthMonitoringSectionHelper.cs
- ListBindingConverter.cs
- WeakEventTable.cs
- FlowDocumentPage.cs
- RecordsAffectedEventArgs.cs
- VisualProxy.cs
- GlobalizationAssembly.cs
- WebServiceResponse.cs
- MetadataSection.cs
- SqlConnection.cs