Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeEventLogWriteHandle.cs / 1305376 / 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; using System.Runtime.Versioning; 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)] [ResourceExposure(ResourceScope.Machine)] internal static extern SafeEventLogWriteHandle RegisterEventSource(string uncServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [ResourceExposure(ResourceScope.None)] [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; using System.Runtime.Versioning; 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)] [ResourceExposure(ResourceScope.Machine)] internal static extern SafeEventLogWriteHandle RegisterEventSource(string uncServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [ResourceExposure(ResourceScope.None)] [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
- RegexRunnerFactory.cs
- MatcherBuilder.cs
- UnrecognizedPolicyAssertionElement.cs
- SecurityPolicyVersion.cs
- WinCategoryAttribute.cs
- SocketCache.cs
- RootAction.cs
- DataContractJsonSerializer.cs
- NullableIntAverageAggregationOperator.cs
- MethodImplAttribute.cs
- RegexMatchCollection.cs
- ScriptManager.cs
- StandardRuntimeEnumValidator.cs
- BorderSidesEditor.cs
- VBCodeProvider.cs
- LayoutEditorPart.cs
- xml.cs
- CompModSwitches.cs
- GridViewColumnHeader.cs
- XmlSerializerImportOptions.cs
- TimeSpanStorage.cs
- RtfControlWordInfo.cs
- ResolvePPIDRequest.cs
- RowTypeElement.cs
- SqlBulkCopyColumnMappingCollection.cs
- PageParser.cs
- TypeResolver.cs
- DeclarationUpdate.cs
- BigInt.cs
- AnonymousIdentificationSection.cs
- Timer.cs
- UpnEndpointIdentityExtension.cs
- TextServicesCompartmentEventSink.cs
- PageThemeCodeDomTreeGenerator.cs
- MaskedTextBoxDesignerActionList.cs
- ToolboxItemWrapper.cs
- CodeMemberField.cs
- WindowClosedEventArgs.cs
- UrlAuthorizationModule.cs
- EntityKeyElement.cs
- AnnotationMap.cs
- JournalNavigationScope.cs
- DelimitedListTraceListener.cs
- GenericsInstances.cs
- DbSetClause.cs
- ListViewDataItem.cs
- SecUtil.cs
- LicenseManager.cs
- CharConverter.cs
- Margins.cs
- InsufficientMemoryException.cs
- DataGridViewHeaderCell.cs
- RightsManagementPermission.cs
- Rijndael.cs
- HtmlHistory.cs
- PageCatalogPart.cs
- XPathDocumentIterator.cs
- FontUnitConverter.cs
- precedingquery.cs
- DbReferenceCollection.cs
- TreeViewItem.cs
- ListenerConnectionDemuxer.cs
- QuaternionKeyFrameCollection.cs
- AttachmentService.cs
- VisualStyleInformation.cs
- UInt64Storage.cs
- HttpInputStream.cs
- DeleteBookmarkScope.cs
- EntityConnectionStringBuilder.cs
- ProtocolInformationWriter.cs
- arc.cs
- BinaryCommonClasses.cs
- CodeMemberMethod.cs
- ListItemParagraph.cs
- ResourceDescriptionAttribute.cs
- FirewallWrapper.cs
- ConcurrentStack.cs
- AVElementHelper.cs
- IndexingContentUnit.cs
- StreamHelper.cs
- EdmFunction.cs
- MimeFormReflector.cs
- TextInfo.cs
- PersonalizableAttribute.cs
- followingsibling.cs
- DbDataReader.cs
- ActivationServices.cs
- PieceNameHelper.cs
- ProxyWebPartConnectionCollection.cs
- InvokeProviderWrapper.cs
- BitmapEffectInput.cs
- ParameterDataSourceExpression.cs
- HttpCacheParams.cs
- DataGridViewRowConverter.cs
- Sorting.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- SchemaExporter.cs
- UIPropertyMetadata.cs
- DbException.cs
- JoinTreeNode.cs