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
- XmlAttributeAttribute.cs
- TableLayoutPanel.cs
- JumpList.cs
- MarshalByValueComponent.cs
- FixUp.cs
- AuthorizationBehavior.cs
- SingletonChannelAcceptor.cs
- MetadataCollection.cs
- ConnectionManager.cs
- CreateUserWizardStep.cs
- WindowsSolidBrush.cs
- StylusPointCollection.cs
- updatecommandorderer.cs
- CodeVariableReferenceExpression.cs
- Stroke.cs
- FileEnumerator.cs
- InstanceCreationEditor.cs
- DataGridViewSelectedColumnCollection.cs
- Win32Native.cs
- DataPagerFieldItem.cs
- PolyBezierSegment.cs
- WorkflowInlining.cs
- LineServicesRun.cs
- QilChoice.cs
- GeneralTransformGroup.cs
- AdapterDictionary.cs
- ProfileSection.cs
- ThreadExceptionDialog.cs
- SetIterators.cs
- GeneralTransform.cs
- BitmapPalettes.cs
- DataAdapter.cs
- SafeArrayRankMismatchException.cs
- unsafenativemethodsother.cs
- ProvideValueServiceProvider.cs
- _ScatterGatherBuffers.cs
- CatalogPartChrome.cs
- CommandValueSerializer.cs
- ToolStripComboBox.cs
- InternalBase.cs
- TypographyProperties.cs
- CssTextWriter.cs
- Comparer.cs
- Maps.cs
- InheritedPropertyChangedEventArgs.cs
- SignatureToken.cs
- ObjectSpanRewriter.cs
- CheckoutException.cs
- DesignerLoader.cs
- DataObjectAttribute.cs
- RevocationPoint.cs
- RepeaterCommandEventArgs.cs
- DataSourceView.cs
- SendDesigner.xaml.cs
- WsatServiceCertificate.cs
- backend.cs
- CachedBitmap.cs
- ManualResetEvent.cs
- CodeDomComponentSerializationService.cs
- EventDescriptor.cs
- CustomTrackingQuery.cs
- Transform.cs
- FreezableCollection.cs
- Stack.cs
- SchemaTableOptionalColumn.cs
- MetafileHeaderWmf.cs
- SoapAttributeOverrides.cs
- ClientRolePrincipal.cs
- ObjectHandle.cs
- CaretElement.cs
- BookmarkEventArgs.cs
- WorkflowApplicationTerminatedException.cs
- WebPartTransformerAttribute.cs
- ColorDialog.cs
- TransactionContextManager.cs
- TabItemWrapperAutomationPeer.cs
- SeparatorAutomationPeer.cs
- GacUtil.cs
- SchemaAttDef.cs
- IPAddressCollection.cs
- UnsafeMethods.cs
- DataSourceDescriptorCollection.cs
- ColorMatrix.cs
- EventProxy.cs
- CodeSubDirectory.cs
- ResourceContainer.cs
- versioninfo.cs
- FreezableCollection.cs
- AssemblyResourceLoader.cs
- TextRunProperties.cs
- FunctionDescription.cs
- TabControlCancelEvent.cs
- DBSqlParser.cs
- InputLanguageSource.cs
- ReflectionUtil.cs
- HostingEnvironmentSection.cs
- Set.cs
- HttpWebRequest.cs
- Cursor.cs
- UniqueConstraint.cs