Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Base64WriteStateInfo.cs
- WebPartUserCapability.cs
- ToolStripLocationCancelEventArgs.cs
- ResourceDisplayNameAttribute.cs
- _LazyAsyncResult.cs
- PaintValueEventArgs.cs
- GlobalItem.cs
- StrongNamePublicKeyBlob.cs
- TypeSystemProvider.cs
- AttributeUsageAttribute.cs
- SecurityElement.cs
- XmlUnspecifiedAttribute.cs
- SqlProviderServices.cs
- AppSettings.cs
- DataTableReaderListener.cs
- DynamicPropertyReader.cs
- SettingsPropertyIsReadOnlyException.cs
- XPathNodeList.cs
- VariableBinder.cs
- WindowsListViewSubItem.cs
- UriSection.cs
- CapiSafeHandles.cs
- ProxyAttribute.cs
- RecognizeCompletedEventArgs.cs
- AccessDataSource.cs
- HttpCookie.cs
- PrintPreviewDialog.cs
- ProbeMatchesMessageCD1.cs
- ProfilePropertyNameValidator.cs
- SystemIPv6InterfaceProperties.cs
- FontStyles.cs
- ClientRuntimeConfig.cs
- HostedTransportConfigurationManager.cs
- SqlRowUpdatingEvent.cs
- MsmqMessageProperty.cs
- Soap.cs
- ValidateNames.cs
- Sentence.cs
- NumberFormatter.cs
- NativeMethods.cs
- GeometryDrawing.cs
- UnmanagedBitmapWrapper.cs
- ListMarkerLine.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- XmlArrayItemAttributes.cs
- Compiler.cs
- TextEffectCollection.cs
- StorageAssociationSetMapping.cs
- SecurityUtils.cs
- TextOnlyOutput.cs
- EdmToObjectNamespaceMap.cs
- DBAsyncResult.cs
- SrgsSemanticInterpretationTag.cs
- ApplicationGesture.cs
- ConfigPathUtility.cs
- FindProgressChangedEventArgs.cs
- WriteableBitmap.cs
- ButtonStandardAdapter.cs
- StrokeIntersection.cs
- CollectionEditorDialog.cs
- OutOfProcStateClientManager.cs
- AuthenticationException.cs
- DataGridViewHitTestInfo.cs
- InputBuffer.cs
- TraceSwitch.cs
- DataAdapter.cs
- TransactionTable.cs
- EventLogPermissionAttribute.cs
- FormsAuthenticationCredentials.cs
- FormConverter.cs
- EntityConnectionStringBuilderItem.cs
- _BaseOverlappedAsyncResult.cs
- HotSpot.cs
- PingReply.cs
- FormatSettings.cs
- HttpDebugHandler.cs
- ZipPackage.cs
- NativeMethods.cs
- AnnotationService.cs
- XmlSchemaAttributeGroupRef.cs
- ParagraphVisual.cs
- SQLInt64Storage.cs
- ConvertTextFrag.cs
- ProvidersHelper.cs
- StylusEventArgs.cs
- UInt16Storage.cs
- ReaderOutput.cs
- FlowDocumentPaginator.cs
- XmlResolver.cs
- FormClosedEvent.cs
- BlockUIContainer.cs
- ApplyTemplatesAction.cs
- XmlSchemaAttributeGroupRef.cs
- MatrixTransform.cs
- Substitution.cs
- FloaterParaClient.cs
- CompModHelpers.cs
- PageClientProxyGenerator.cs
- PrinterUnitConvert.cs
- ItemList.cs