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
- EntityModelBuildProvider.cs
- DataGridColumn.cs
- JsonReader.cs
- ContractCodeDomInfo.cs
- GroupBox.cs
- RawStylusSystemGestureInputReport.cs
- SafeIUnknown.cs
- CodeExpressionStatement.cs
- WorkflowViewStateService.cs
- FtpRequestCacheValidator.cs
- _SafeNetHandles.cs
- FontStyles.cs
- VoiceInfo.cs
- VersionUtil.cs
- COM2ExtendedTypeConverter.cs
- CheckBox.cs
- ActiveXHost.cs
- HostProtectionException.cs
- PrintController.cs
- TcpHostedTransportConfiguration.cs
- BulletedList.cs
- MemberPath.cs
- DomNameTable.cs
- EdmMember.cs
- XmlSchemaAnyAttribute.cs
- PropertyDescriptorCollection.cs
- OleDbConnectionInternal.cs
- CheckBoxList.cs
- QueryPageSettingsEventArgs.cs
- ToolStripGrip.cs
- RepeatButton.cs
- GreenMethods.cs
- SchemaCreator.cs
- DefaultTraceListener.cs
- AttachmentService.cs
- EncoderNLS.cs
- XsdBuilder.cs
- AsymmetricAlgorithm.cs
- HierarchicalDataBoundControl.cs
- PrinterSettings.cs
- PerformanceCounterPermissionEntry.cs
- TraceXPathNavigator.cs
- SchemaElement.cs
- RegistryKey.cs
- ValueSerializerAttribute.cs
- ResourceDescriptionAttribute.cs
- RectConverter.cs
- HTTPNotFoundHandler.cs
- Track.cs
- XmlSchemaImporter.cs
- XmlDataImplementation.cs
- XPathNode.cs
- GradientStopCollection.cs
- VectorAnimationUsingKeyFrames.cs
- DataGridViewCheckBoxCell.cs
- PrintController.cs
- ConcurrentBag.cs
- HeaderCollection.cs
- SchemaInfo.cs
- SqlDataSourceConfigureFilterForm.cs
- RSAPKCS1SignatureDeformatter.cs
- FrameworkName.cs
- SignerInfo.cs
- HTMLTextWriter.cs
- SqlDataSourceSelectingEventArgs.cs
- CmsInterop.cs
- BStrWrapper.cs
- ToolStripContentPanelRenderEventArgs.cs
- SiteMembershipCondition.cs
- ProgressChangedEventArgs.cs
- StateBag.cs
- IPHostEntry.cs
- SoapTypeAttribute.cs
- securestring.cs
- Gdiplus.cs
- MonthCalendarDesigner.cs
- BamlStream.cs
- XmlJsonWriter.cs
- Native.cs
- DataGridItemCollection.cs
- PerformanceCounterPermissionAttribute.cs
- ContentTextAutomationPeer.cs
- Set.cs
- SharedUtils.cs
- TypeSystemProvider.cs
- Column.cs
- TiffBitmapEncoder.cs
- TextTrailingCharacterEllipsis.cs
- VectorCollectionValueSerializer.cs
- securestring.cs
- Operator.cs
- TableCellAutomationPeer.cs
- PingReply.cs
- ModuleConfigurationInfo.cs
- MenuItemStyleCollection.cs
- XamlSerializer.cs
- ReadWriteControlDesigner.cs
- BevelBitmapEffect.cs
- AppSettingsExpressionBuilder.cs
- Journal.cs