Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / SMDiagnostics / System / ServiceModel / Diagnostics / SafeEventLogWriteHandle.cs / 1 / SafeEventLogWriteHandle.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Diagnostics { using Microsoft.Win32.SafeHandles; using System.Runtime.InteropServices; using System.Globalization; using System.Diagnostics; internal sealed class SafeEventLogWriteHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note: RegisterEventSource returns 0 on failure SafeEventLogWriteHandle() : base(true) { } internal static SafeEventLogWriteHandle RegisterEventSource(string uncServerName, string sourceName) { SafeEventLogWriteHandle retval = NativeMethods.RegisterEventSource(uncServerName, sourceName); int error = Marshal.GetLastWin32Error(); if (retval.IsInvalid) { Debug.Print("SafeEventLogWriteHandle::RegisterEventSource[" + uncServerName + ", " + sourceName + "] Failed. Last Error: " + error.ToString(CultureInfo.InvariantCulture)); } return retval; } [DllImport("advapi32", SetLastError = true)] private static extern bool DeregisterEventSource(IntPtr hEventLog); #pragma warning disable 56523 override protected bool ReleaseHandle() { return DeregisterEventSource(this.handle); } #pragma warning restore 56523 } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HttpProfileGroupBase.cs
- PointCollectionConverter.cs
- WS2007FederationHttpBinding.cs
- ArrayWithOffset.cs
- TypeExtensionSerializer.cs
- SerializerDescriptor.cs
- Pool.cs
- TypeValidationEventArgs.cs
- CustomSignedXml.cs
- DecimalAnimation.cs
- PropertyTab.cs
- MouseActionValueSerializer.cs
- SourceFileBuildProvider.cs
- CaseInsensitiveOrdinalStringComparer.cs
- graph.cs
- CommandValueSerializer.cs
- LiteralControl.cs
- SmtpCommands.cs
- AdvancedBindingEditor.cs
- XmlWriter.cs
- CommandPlan.cs
- MD5.cs
- DataBindingHandlerAttribute.cs
- SignalGate.cs
- Model3D.cs
- DictionarySectionHandler.cs
- DataServiceStreamResponse.cs
- FormCollection.cs
- FlowDocumentReader.cs
- Stacktrace.cs
- XsdBuildProvider.cs
- LinqDataSourceDisposeEventArgs.cs
- SelectedGridItemChangedEvent.cs
- ArrayListCollectionBase.cs
- CheckBoxList.cs
- XmlChildNodes.cs
- SqlLiftWhereClauses.cs
- documentsequencetextcontainer.cs
- DbFunctionCommandTree.cs
- RegexRunnerFactory.cs
- SimpleType.cs
- PropertyInfoSet.cs
- FunctionDescription.cs
- SmtpFailedRecipientsException.cs
- baseaxisquery.cs
- ConsumerConnectionPoint.cs
- SqlTypeConverter.cs
- LocalizeDesigner.cs
- propertyentry.cs
- ValueQuery.cs
- PrintPreviewGraphics.cs
- HitTestParameters3D.cs
- SeekStoryboard.cs
- CompilationUnit.cs
- DataGridViewRowPrePaintEventArgs.cs
- EventLogPermissionEntry.cs
- DateTime.cs
- HtmlInputControl.cs
- ReferentialConstraint.cs
- UInt64Storage.cs
- ScaleTransform3D.cs
- querybuilder.cs
- CheckBoxRenderer.cs
- CanonicalFontFamilyReference.cs
- BroadcastEventHelper.cs
- QilNode.cs
- DuplicateDetector.cs
- SoapFormatter.cs
- HandlerFactoryCache.cs
- RoleManagerModule.cs
- GeneralTransform3D.cs
- AttachInfo.cs
- CFGGrammar.cs
- HtmlTableRow.cs
- ChannelSinkStacks.cs
- StyleBamlTreeBuilder.cs
- ImageMapEventArgs.cs
- ExclusiveCanonicalizationTransform.cs
- DataIdProcessor.cs
- ExpressionPrefixAttribute.cs
- SystemFonts.cs
- FontTypeConverter.cs
- QueryCacheEntry.cs
- OutputCacheProfileCollection.cs
- XsdBuildProvider.cs
- WorkerRequest.cs
- SessionStateSection.cs
- FamilyMap.cs
- ToolBar.cs
- CalendarSelectionChangedEventArgs.cs
- DecoratedNameAttribute.cs
- EventPropertyMap.cs
- ChangesetResponse.cs
- TreeNodeStyle.cs
- StorageModelBuildProvider.cs
- SchemaExporter.cs
- KeyGestureValueSerializer.cs
- SqlGenerator.cs
- SpellerInterop.cs
- EntitySqlQueryCacheEntry.cs