Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- NamedServiceModelExtensionCollectionElement.cs
- RegexMatchCollection.cs
- HtmlShim.cs
- EntityDesignerBuildProvider.cs
- BamlTreeNode.cs
- XmlTextAttribute.cs
- GestureRecognizer.cs
- OracleFactory.cs
- ProtocolsConfigurationHandler.cs
- Tag.cs
- FilterQuery.cs
- CacheMemory.cs
- ExpressionReplacer.cs
- XmlNodeComparer.cs
- SchemaLookupTable.cs
- MemberListBinding.cs
- CaseStatementSlot.cs
- FixedBufferAttribute.cs
- ContentValidator.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- ImportOptions.cs
- HijriCalendar.cs
- HttpCacheParams.cs
- CurrentChangedEventManager.cs
- ContextStaticAttribute.cs
- CodeMemberField.cs
- OutputCacheSettings.cs
- ValidateNames.cs
- HostProtectionException.cs
- WorkflowServiceBehavior.cs
- ChtmlCalendarAdapter.cs
- MediaElement.cs
- ArgIterator.cs
- XhtmlTextWriter.cs
- RunClient.cs
- TreeViewEvent.cs
- BlurBitmapEffect.cs
- HttpPostedFile.cs
- WebRequestModulesSection.cs
- StringArrayEditor.cs
- TextBox.cs
- _NestedSingleAsyncResult.cs
- RawStylusInputReport.cs
- TextElementCollection.cs
- DesignerDataStoredProcedure.cs
- GridViewPageEventArgs.cs
- QuaternionKeyFrameCollection.cs
- CodeCommentStatementCollection.cs
- CngUIPolicy.cs
- SiteMapNodeItemEventArgs.cs
- ObjectStateManagerMetadata.cs
- ExpressionVisitor.cs
- Socket.cs
- InputManager.cs
- OperationResponse.cs
- UrlAuthFailureHandler.cs
- XmlAttribute.cs
- Camera.cs
- PropertyFilterAttribute.cs
- CatalogZoneAutoFormat.cs
- DbConnectionInternal.cs
- PrintDialog.cs
- PeerTransportListenAddressValidatorAttribute.cs
- Number.cs
- RSAPKCS1SignatureDeformatter.cs
- EventSinkHelperWriter.cs
- PriorityItem.cs
- CompiledQueryCacheEntry.cs
- InstanceDataCollection.cs
- StrokeCollection.cs
- SizeAnimationBase.cs
- BasicHttpMessageSecurityElement.cs
- objectquery_tresulttype.cs
- ViewManager.cs
- ResXBuildProvider.cs
- MailDefinition.cs
- ToolboxItemImageConverter.cs
- XmlCDATASection.cs
- cookiecollection.cs
- TypeFieldSchema.cs
- DataRelationCollection.cs
- ClosableStream.cs
- UnsafeNetInfoNativeMethods.cs
- Image.cs
- SqlConnectionHelper.cs
- SamlConditions.cs
- FacetChecker.cs
- ObjectStateManagerMetadata.cs
- MatrixCamera.cs
- DragDropHelper.cs
- TraceShell.cs
- GridViewRow.cs
- ResXDataNode.cs
- MarkerProperties.cs
- StateItem.cs
- SrgsDocumentParser.cs
- Facet.cs
- ImageSource.cs
- RadioButtonList.cs
- KeySpline.cs