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
- nulltextcontainer.cs
- PassportAuthenticationEventArgs.cs
- TreeNodeStyle.cs
- Subset.cs
- Quad.cs
- InstallerTypeAttribute.cs
- ClonableStack.cs
- MouseActionConverter.cs
- DataGridViewCellConverter.cs
- DLinqTableProvider.cs
- SqlWebEventProvider.cs
- SlotInfo.cs
- FormsAuthenticationConfiguration.cs
- DataGridViewColumnStateChangedEventArgs.cs
- HtmlMeta.cs
- storepermission.cs
- Asn1IntegerConverter.cs
- IntPtr.cs
- WindowsIPAddress.cs
- WebPartTransformerAttribute.cs
- SchemaExporter.cs
- WebBaseEventKeyComparer.cs
- PackageRelationshipCollection.cs
- PerspectiveCamera.cs
- ListControl.cs
- CompilerErrorCollection.cs
- ToolBarTray.cs
- EncoderFallback.cs
- UniformGrid.cs
- MsmqInputSessionChannelListener.cs
- ObjRef.cs
- UpdateProgress.cs
- CngAlgorithmGroup.cs
- SharedDp.cs
- KeyEvent.cs
- DataGridPagerStyle.cs
- SiteMembershipCondition.cs
- HyperLinkStyle.cs
- WindowsFormsHostPropertyMap.cs
- GridView.cs
- QilUnary.cs
- _ChunkParse.cs
- BitVec.cs
- WindowsFont.cs
- RelatedImageListAttribute.cs
- RayMeshGeometry3DHitTestResult.cs
- QueryCacheManager.cs
- SelectionEditor.cs
- SimplePropertyEntry.cs
- CompilationUnit.cs
- ScriptRef.cs
- NotSupportedException.cs
- Sentence.cs
- HtmlTableRow.cs
- DesignTimeValidationFeature.cs
- PropertyPathWorker.cs
- ErrorItem.cs
- XmlBoundElement.cs
- VoiceObjectToken.cs
- StringFreezingAttribute.cs
- BitFlagsGenerator.cs
- CapabilitiesPattern.cs
- LinearKeyFrames.cs
- ValidationSummary.cs
- TimelineGroup.cs
- COM2TypeInfoProcessor.cs
- ProtocolsSection.cs
- FirstMatchCodeGroup.cs
- TransformerConfigurationWizardBase.cs
- DataGridViewButtonColumn.cs
- DataBoundControlAdapter.cs
- AssemblyAssociatedContentFileAttribute.cs
- XmlSignatureProperties.cs
- MetadataProperty.cs
- WriteableBitmap.cs
- FunctionParameter.cs
- Statements.cs
- SymLanguageVendor.cs
- PropagatorResult.cs
- OleDbParameter.cs
- XamlSerializerUtil.cs
- EndGetFileNameFromUserRequest.cs
- TdsParserSessionPool.cs
- WindowsListViewItemStartMenu.cs
- ApplicationActivator.cs
- TypeResolver.cs
- PolygonHotSpot.cs
- WebConfigurationHost.cs
- LocalValueEnumerator.cs
- PageThemeParser.cs
- CompositeFontFamily.cs
- CharStorage.cs
- PathGradientBrush.cs
- OrderByQueryOptionExpression.cs
- ProfileSection.cs
- PrincipalPermission.cs
- IsolatedStorageFile.cs
- CodeDOMProvider.cs
- ReliabilityContractAttribute.cs
- CodeMethodReturnStatement.cs