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
- SqlConnectionString.cs
- ProfilePropertySettingsCollection.cs
- ISAPIApplicationHost.cs
- BuildProvidersCompiler.cs
- XmlDocumentSerializer.cs
- TraceSource.cs
- ProcessRequestArgs.cs
- IdnMapping.cs
- SqlCacheDependencyDatabaseCollection.cs
- ContextMarshalException.cs
- Crc32Helper.cs
- LinqDataSourceDeleteEventArgs.cs
- IndexOutOfRangeException.cs
- TextBoxAutomationPeer.cs
- ActivityValidator.cs
- StandardOleMarshalObject.cs
- PingOptions.cs
- AllMembershipCondition.cs
- LocalizableResourceBuilder.cs
- LogLogRecordEnumerator.cs
- JobDuplex.cs
- IPGlobalProperties.cs
- ComboBoxAutomationPeer.cs
- HttpApplication.cs
- CachedPathData.cs
- activationcontext.cs
- TypeExtensionConverter.cs
- validationstate.cs
- XmlSchemaElement.cs
- EmbeddedObject.cs
- LineInfo.cs
- MsmqUri.cs
- ExpressionWriter.cs
- SymmetricAlgorithm.cs
- ReadOnlyHierarchicalDataSource.cs
- _DomainName.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- ToolStripDropDownClosedEventArgs.cs
- Int64.cs
- FontFamilyValueSerializer.cs
- DotNetATv1WindowsLogEntryDeserializer.cs
- XPathQilFactory.cs
- SamlAuthorityBinding.cs
- EncryptedPackageFilter.cs
- WebFaultException.cs
- DocumentXmlWriter.cs
- LazyTextWriterCreator.cs
- MsmqTransportSecurityElement.cs
- CodeLabeledStatement.cs
- ZipIOCentralDirectoryFileHeader.cs
- WinEventWrap.cs
- ListChangedEventArgs.cs
- HostProtectionException.cs
- FocusChangedEventArgs.cs
- CodeEventReferenceExpression.cs
- EventLogPermissionEntry.cs
- ExpandoObject.cs
- DataFieldEditor.cs
- JsonObjectDataContract.cs
- StylusTouchDevice.cs
- ImageFormatConverter.cs
- BoundingRectTracker.cs
- Panel.cs
- RawStylusInputCustomDataList.cs
- SQLDouble.cs
- WindowsEditBoxRange.cs
- BrowserCapabilitiesCompiler.cs
- TdsParserSafeHandles.cs
- RelationshipFixer.cs
- ADMembershipProvider.cs
- FamilyTypeface.cs
- ChangeBlockUndoRecord.cs
- SessionStateSection.cs
- PropertyStore.cs
- Error.cs
- SqlExpander.cs
- Queue.cs
- ScriptResourceHandler.cs
- ConvertTextFrag.cs
- BooleanKeyFrameCollection.cs
- DesignTimeType.cs
- PolyBezierSegmentFigureLogic.cs
- SubpageParaClient.cs
- DeviceContext.cs
- WorkItem.cs
- CodeCatchClauseCollection.cs
- Int32RectConverter.cs
- AdapterDictionary.cs
- DecimalAnimationBase.cs
- RegexStringValidator.cs
- AutomationIdentifierGuids.cs
- SchemaNames.cs
- TextBoxRenderer.cs
- ServiceOperation.cs
- OleDbErrorCollection.cs
- TextShapeableCharacters.cs
- SchemaCollectionPreprocessor.cs
- SerializationInfo.cs
- SID.cs
- FileLevelControlBuilderAttribute.cs