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
- Literal.cs
- XsdBuildProvider.cs
- SparseMemoryStream.cs
- CapabilitiesAssignment.cs
- ExtendedProtectionPolicyElement.cs
- ColorBlend.cs
- ConnectionProviderAttribute.cs
- ComponentResourceManager.cs
- SqlColumnizer.cs
- TextShapeableCharacters.cs
- CurrentChangingEventArgs.cs
- RegistryKey.cs
- EventWaitHandle.cs
- DiagnosticTraceSource.cs
- LinqDataSourceContextEventArgs.cs
- SqlOuterApplyReducer.cs
- ParameterCollection.cs
- RepeatBehaviorConverter.cs
- WebMethodAttribute.cs
- DictionaryKeyPropertyAttribute.cs
- DataMember.cs
- RichTextBoxConstants.cs
- Qualifier.cs
- HttpApplicationFactory.cs
- Point.cs
- AdRotator.cs
- sqlmetadatafactory.cs
- CodeDomConfigurationHandler.cs
- ClientConfigurationSystem.cs
- NetworkInterface.cs
- BindingCollectionElement.cs
- XMLSyntaxException.cs
- SynchronizedDisposablePool.cs
- SplashScreen.cs
- BitmapScalingModeValidation.cs
- FacetValueContainer.cs
- TypeUtil.cs
- DependentList.cs
- FontStretch.cs
- TextDecoration.cs
- DbTransaction.cs
- ThicknessAnimationUsingKeyFrames.cs
- JournalEntry.cs
- BufferedWebEventProvider.cs
- OleDbEnumerator.cs
- RemoteWebConfigurationHostServer.cs
- XPathNodePointer.cs
- ObservableCollection.cs
- SafeNativeMethods.cs
- ListBindableAttribute.cs
- XmlSignatureManifest.cs
- SmiContext.cs
- SharedDp.cs
- DoubleCollectionConverter.cs
- PropertyGridCommands.cs
- TickBar.cs
- RequestContext.cs
- ObjectConverter.cs
- _emptywebproxy.cs
- DataGridCell.cs
- FixedSOMTable.cs
- TextServicesCompartment.cs
- ConnectionProviderAttribute.cs
- BamlCollectionHolder.cs
- PersistenceTypeAttribute.cs
- __Filters.cs
- StylusPointPropertyUnit.cs
- IncomingWebResponseContext.cs
- ColumnHeaderConverter.cs
- mactripleDES.cs
- WindowsRebar.cs
- Journal.cs
- PathTooLongException.cs
- ConfigXmlElement.cs
- AdapterDictionary.cs
- SecureConversationServiceCredential.cs
- ExpandCollapsePattern.cs
- AssemblyAssociatedContentFileAttribute.cs
- DeferrableContent.cs
- Subordinate.cs
- RenderDataDrawingContext.cs
- RangeValidator.cs
- UpdateCompiler.cs
- EntityTransaction.cs
- PromptStyle.cs
- IRCollection.cs
- SafeFindHandle.cs
- ChildChangedEventArgs.cs
- ZipPackage.cs
- ListenerElementsCollection.cs
- BufferedStream2.cs
- ElementNotAvailableException.cs
- ReaderWriterLockWrapper.cs
- DecimalAnimationBase.cs
- CompositeKey.cs
- RuleInfoComparer.cs
- documentsequencetextcontainer.cs
- AddInController.cs
- TraceProvider.cs
- BindingGroup.cs