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
- TimelineGroup.cs
- _AutoWebProxyScriptWrapper.cs
- ApplicationGesture.cs
- TypeSystem.cs
- WebPartConnectionsEventArgs.cs
- CompModSwitches.cs
- CornerRadiusConverter.cs
- HttpCacheVary.cs
- CheckableControlBaseAdapter.cs
- IndexedEnumerable.cs
- FlatButtonAppearance.cs
- CachedPathData.cs
- RegexFCD.cs
- DocumentSchemaValidator.cs
- Bind.cs
- SqlDataSourceEnumerator.cs
- dtdvalidator.cs
- ScrollBarAutomationPeer.cs
- XmlNamespaceMappingCollection.cs
- EdgeModeValidation.cs
- SelectionPattern.cs
- XmlUtilWriter.cs
- DoubleMinMaxAggregationOperator.cs
- ToolStripScrollButton.cs
- InstanceKeyCompleteException.cs
- CodeTypeReferenceCollection.cs
- ThemeableAttribute.cs
- DesignerForm.cs
- MenuItemBinding.cs
- XmlAnyElementAttributes.cs
- ConnectionProviderAttribute.cs
- DetailsViewRow.cs
- OdbcErrorCollection.cs
- OverflowException.cs
- ErrorBehavior.cs
- SslStream.cs
- AssemblyBuilderData.cs
- FillRuleValidation.cs
- GradientStop.cs
- ReflectionPermission.cs
- XmlLoader.cs
- DataViewSettingCollection.cs
- MultipartContentParser.cs
- TraceContext.cs
- FixedDocument.cs
- PrimitiveSchema.cs
- CheckBoxFlatAdapter.cs
- QueryInterceptorAttribute.cs
- PartDesigner.cs
- AutomationTextAttribute.cs
- PersonalizationProvider.cs
- LayoutEngine.cs
- CheckBoxDesigner.cs
- FormsAuthenticationEventArgs.cs
- COM2IProvidePropertyBuilderHandler.cs
- ValueType.cs
- UrlMapping.cs
- Image.cs
- DomNameTable.cs
- Int64AnimationUsingKeyFrames.cs
- TypedElement.cs
- CursorConverter.cs
- AdCreatedEventArgs.cs
- Transform.cs
- DesigntimeLicenseContext.cs
- Positioning.cs
- XmlWriter.cs
- DropShadowEffect.cs
- TableFieldsEditor.cs
- FunctionNode.cs
- CqlGenerator.cs
- SqlProviderManifest.cs
- DBDataPermissionAttribute.cs
- TreeViewEvent.cs
- ZipPackage.cs
- Clause.cs
- _ListenerRequestStream.cs
- TreeChangeInfo.cs
- InternalConfigHost.cs
- ExecutionContext.cs
- ListItemConverter.cs
- GuidelineCollection.cs
- CursorConverter.cs
- EmbeddedMailObject.cs
- GlobalItem.cs
- brushes.cs
- TypePresenter.xaml.cs
- UndirectedGraph.cs
- DebugHandleTracker.cs
- ConfigurationSchemaErrors.cs
- TypeHelpers.cs
- HtmlGenericControl.cs
- FactoryId.cs
- Label.cs
- ControlIdConverter.cs
- SelectionWordBreaker.cs
- NetworkInformationException.cs
- HttpListenerContext.cs
- CellConstantDomain.cs
- ProxyHwnd.cs