Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeEventLogWriteHandle.cs / 1 / SafeEventLogWriteHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeEventLogWriteHandle ** **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 SafeEventLogWriteHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note: RegisterEventSource returns 0 on failure internal SafeEventLogWriteHandle () : base(true) {} [DllImport(ExternDll.Advapi32, CharSet=System.Runtime.InteropServices.CharSet.Unicode, SetLastError=true)] internal static extern SafeEventLogWriteHandle RegisterEventSource(string uncServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool DeregisterEventSource(IntPtr hEventLog); override protected bool ReleaseHandle() { return DeregisterEventSource(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeEventLogWriteHandle ** **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 SafeEventLogWriteHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note: RegisterEventSource returns 0 on failure internal SafeEventLogWriteHandle () : base(true) {} [DllImport(ExternDll.Advapi32, CharSet=System.Runtime.InteropServices.CharSet.Unicode, SetLastError=true)] internal static extern SafeEventLogWriteHandle RegisterEventSource(string uncServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool DeregisterEventSource(IntPtr hEventLog); override protected bool ReleaseHandle() { return DeregisterEventSource(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
- CompilerErrorCollection.cs
- SqlProviderServices.cs
- TextTreeUndo.cs
- BooleanAnimationBase.cs
- MULTI_QI.cs
- CachingHintValidation.cs
- XmlAttributeHolder.cs
- Transform.cs
- MouseGestureConverter.cs
- SqlDataSource.cs
- OperatorExpressions.cs
- ErrorWebPart.cs
- XmlNodeReader.cs
- SymLanguageVendor.cs
- ResourceReader.cs
- ObjectItemNoOpAssemblyLoader.cs
- ToolZone.cs
- ExtendedPropertyDescriptor.cs
- SchemaImporterExtensionsSection.cs
- TypeReference.cs
- ControlType.cs
- WindowInteropHelper.cs
- ContainerParagraph.cs
- EntityDataSourceView.cs
- TraceContextEventArgs.cs
- SecurityBindingElementImporter.cs
- VariantWrapper.cs
- UDPClient.cs
- CorrelationTokenTypeConvertor.cs
- NameTable.cs
- SupportsEventValidationAttribute.cs
- MatrixTransform3D.cs
- UniqueEventHelper.cs
- ErrorReporting.cs
- MetabaseSettings.cs
- ValidatedControlConverter.cs
- TraceHwndHost.cs
- SQLString.cs
- SingleTagSectionHandler.cs
- GridEntry.cs
- ThrowOnMultipleAssignment.cs
- DataGridViewRow.cs
- DrawingServices.cs
- KeySpline.cs
- TransferRequestHandler.cs
- ContentDisposition.cs
- ProcessRequestAsyncResult.cs
- XmlSchemaDocumentation.cs
- NodeLabelEditEvent.cs
- HttpCacheVaryByContentEncodings.cs
- SynchronizingStream.cs
- AnnotationDocumentPaginator.cs
- XmlSchemaAnyAttribute.cs
- CachedFontFace.cs
- UpDownEvent.cs
- DynamicActivityTypeDescriptor.cs
- ProcessModuleCollection.cs
- PointLightBase.cs
- XmlILAnnotation.cs
- KeyPressEvent.cs
- metadatamappinghashervisitor.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- HScrollBar.cs
- DataGridToolTip.cs
- ConfigXmlText.cs
- PhysicalAddress.cs
- FlowDecision.cs
- TripleDESCryptoServiceProvider.cs
- BulletedList.cs
- ICspAsymmetricAlgorithm.cs
- XPathArrayIterator.cs
- ResourceIDHelper.cs
- QuadraticBezierSegment.cs
- HttpWebRequest.cs
- EntityWrapperFactory.cs
- ResourceDictionary.cs
- PathStreamGeometryContext.cs
- CallbackBehaviorAttribute.cs
- AutomationElementCollection.cs
- ThemeDirectoryCompiler.cs
- GridItem.cs
- ConfigPathUtility.cs
- SecurityDocument.cs
- FontClient.cs
- Form.cs
- sortedlist.cs
- FileSystemInfo.cs
- ThemeInfoAttribute.cs
- ListViewGroup.cs
- TransactionFlowElement.cs
- QueueProcessor.cs
- CryptoSession.cs
- XmlMtomReader.cs
- HierarchicalDataBoundControl.cs
- ArrangedElementCollection.cs
- _ContextAwareResult.cs
- WebPartEditorCancelVerb.cs
- BuildProvidersCompiler.cs
- ParseElement.cs
- PtsHelper.cs