Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PeerNameResolver.cs
- Baml6ConstructorInfo.cs
- VectorCollection.cs
- Util.cs
- ToolStripSeparator.cs
- ToolStripAdornerWindowService.cs
- ObjectManager.cs
- TableSectionStyle.cs
- GetParentChain.cs
- ConditionCollection.cs
- TableLayoutPanel.cs
- panel.cs
- SchemaImporterExtensionElementCollection.cs
- StylusButtonCollection.cs
- Point3DAnimationBase.cs
- BezierSegment.cs
- DoubleMinMaxAggregationOperator.cs
- XsdValidatingReader.cs
- StringDictionaryWithComparer.cs
- TraceContext.cs
- FileLoadException.cs
- AsyncDataRequest.cs
- PrintingPermissionAttribute.cs
- TransformationRules.cs
- Help.cs
- WebPartExportVerb.cs
- ClipboardProcessor.cs
- ISAPIWorkerRequest.cs
- RelationshipType.cs
- AddingNewEventArgs.cs
- FlowNode.cs
- UserInitiatedNavigationPermission.cs
- SQLChars.cs
- BigInt.cs
- MediaElement.cs
- FixedFindEngine.cs
- NullPackagingPolicy.cs
- PhoneCall.cs
- ComboBoxAutomationPeer.cs
- EntityUtil.cs
- HotCommands.cs
- SizeConverter.cs
- UriTemplateVariablePathSegment.cs
- HttpConfigurationContext.cs
- AppSettingsReader.cs
- MetadataItemCollectionFactory.cs
- LexicalChunk.cs
- MarshalDirectiveException.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- DetailsViewUpdateEventArgs.cs
- Camera.cs
- Operator.cs
- XmlSchemaSubstitutionGroup.cs
- NativeActivityTransactionContext.cs
- TextTreeTextBlock.cs
- TreeView.cs
- RoleGroupCollection.cs
- ChildrenQuery.cs
- CmsInterop.cs
- GenericAuthenticationEventArgs.cs
- SystemUnicastIPAddressInformation.cs
- EnumValAlphaComparer.cs
- DetailsViewModeEventArgs.cs
- CodeIdentifiers.cs
- HMACSHA384.cs
- OperationCanceledException.cs
- GroupByExpressionRewriter.cs
- AppDomainAttributes.cs
- BufferedWebEventProvider.cs
- TextBox.cs
- TextTreeUndo.cs
- WindowsGraphics.cs
- AttachInfo.cs
- QilTypeChecker.cs
- TextEditor.cs
- DbSourceCommand.cs
- MeshGeometry3D.cs
- SafeArrayRankMismatchException.cs
- CompoundFileStorageReference.cs
- ProcessActivityTreeOptions.cs
- PageAsyncTaskManager.cs
- DomainUpDown.cs
- Transform3D.cs
- LambdaCompiler.Unary.cs
- SqlNotificationEventArgs.cs
- PaintValueEventArgs.cs
- ClientTargetSection.cs
- WebScriptEnablingElement.cs
- DialogWindow.cs
- ClientConvert.cs
- SetterBaseCollection.cs
- InvalidOperationException.cs
- CompiledIdentityConstraint.cs
- XmlNodeList.cs
- RequiredAttributeAttribute.cs
- Rights.cs
- BitmapDecoder.cs
- StreamReader.cs
- DecoderReplacementFallback.cs
- WriteTimeStream.cs