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
- LassoHelper.cs
- SettingsPropertyWrongTypeException.cs
- ConstraintConverter.cs
- CorePropertiesFilter.cs
- RuleRef.cs
- altserialization.cs
- Int32CAMarshaler.cs
- StandardOleMarshalObject.cs
- ConfigXmlElement.cs
- WebDescriptionAttribute.cs
- MaxMessageSizeStream.cs
- HtmlInputImage.cs
- ShaderEffect.cs
- ValueSerializer.cs
- PageAdapter.cs
- PropertyEmitter.cs
- CompilerTypeWithParams.cs
- SparseMemoryStream.cs
- CommandTreeTypeHelper.cs
- EntityViewContainer.cs
- WebSysDisplayNameAttribute.cs
- ColorConvertedBitmap.cs
- WpfXamlType.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- IISMapPath.cs
- PreloadedPackages.cs
- VolatileEnlistmentState.cs
- DesignerMetadata.cs
- CqlLexer.cs
- InternalPolicyElement.cs
- MarkupExtensionParser.cs
- ProfileSettings.cs
- EditorBrowsableAttribute.cs
- coordinator.cs
- ObjectTypeMapping.cs
- EntityChangedParams.cs
- DataObjectSettingDataEventArgs.cs
- EntityFrameworkVersions.cs
- LogReservationCollection.cs
- UniqueContractNameValidationBehavior.cs
- ConfigurationManagerInternal.cs
- DockAndAnchorLayout.cs
- ReferenceEqualityComparer.cs
- InheritanceContextChangedEventManager.cs
- MetadataUtilsSmi.cs
- PageAction.cs
- DataControlFieldHeaderCell.cs
- CachedCompositeFamily.cs
- ToolboxItemFilterAttribute.cs
- ConnectionManagementSection.cs
- XmlDictionary.cs
- ServiceDocument.cs
- Invariant.cs
- ControlEvent.cs
- GPPOINTF.cs
- ImageKeyConverter.cs
- WorkflowMarkupSerializer.cs
- QueryServiceConfigHandle.cs
- ProfilePropertySettings.cs
- mil_commands.cs
- InstanceNormalEvent.cs
- DiscoveryClientDuplexChannel.cs
- WebServiceMethodData.cs
- GeneralTransform3DGroup.cs
- ContextMenuStripGroup.cs
- PackageFilter.cs
- QueryOutputWriter.cs
- CapacityStreamGeometryContext.cs
- TransactionFlowProperty.cs
- AssemblyUtil.cs
- ClientRuntimeConfig.cs
- WsatAdminException.cs
- PtsHelper.cs
- XmlSchemaInclude.cs
- StreamResourceInfo.cs
- HMACMD5.cs
- SystemGatewayIPAddressInformation.cs
- ArgumentFixer.cs
- DataGridView.cs
- DataGridViewDataErrorEventArgs.cs
- ModuleConfigurationInfo.cs
- OpenTypeLayout.cs
- HandlerFactoryWrapper.cs
- TextBoxLine.cs
- NetTcpSectionData.cs
- TextSelection.cs
- IisTraceWebEventProvider.cs
- XmlILOptimizerVisitor.cs
- PointHitTestParameters.cs
- ExpandCollapsePattern.cs
- AttributeInfo.cs
- FragmentNavigationEventArgs.cs
- SafeMILHandleMemoryPressure.cs
- rsa.cs
- COAUTHIDENTITY.cs
- RuntimeConfigLKG.cs
- HttpWebRequestElement.cs
- BindingManagerDataErrorEventArgs.cs
- FixedSOMTextRun.cs
- __Error.cs