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
- Point3DAnimationBase.cs
- DataGridViewCellEventArgs.cs
- MaskedTextProvider.cs
- Timeline.cs
- DocumentOrderComparer.cs
- ProcessModelInfo.cs
- RawStylusInputReport.cs
- COM2Properties.cs
- SizeFConverter.cs
- LayoutInformation.cs
- TakeQueryOptionExpression.cs
- _OSSOCK.cs
- WebPartCloseVerb.cs
- Privilege.cs
- Dump.cs
- DataGridViewColumnEventArgs.cs
- StateWorkerRequest.cs
- AlphaSortedEnumConverter.cs
- LZCodec.cs
- StringFunctions.cs
- CompareValidator.cs
- HtmlToClrEventProxy.cs
- _NestedSingleAsyncResult.cs
- xmlglyphRunInfo.cs
- CacheAxisQuery.cs
- UriTemplateHelpers.cs
- KeyPressEvent.cs
- BuildProviderUtils.cs
- MessageBox.cs
- Point4D.cs
- FixedSOMTextRun.cs
- FormViewCommandEventArgs.cs
- AttachedAnnotation.cs
- ProtectedConfiguration.cs
- QuaternionIndependentAnimationStorage.cs
- StylusTip.cs
- PersonalizationProviderCollection.cs
- SqlPersonalizationProvider.cs
- ToolStripDesignerAvailabilityAttribute.cs
- XmlSchemaException.cs
- ObjectDesignerDataSourceView.cs
- wmiprovider.cs
- Int64AnimationUsingKeyFrames.cs
- versioninfo.cs
- Transform.cs
- ContractListAdapter.cs
- EdmRelationshipRoleAttribute.cs
- ResetableIterator.cs
- WpfKnownTypeInvoker.cs
- DocumentPageViewAutomationPeer.cs
- Stroke.cs
- SparseMemoryStream.cs
- SplitterPanel.cs
- Int32Rect.cs
- XmlSchemaInclude.cs
- Model3DGroup.cs
- ResolvedKeyFrameEntry.cs
- EntityDataSourceSelectedEventArgs.cs
- MetadataStore.cs
- baseaxisquery.cs
- HwndProxyElementProvider.cs
- OracleException.cs
- SiteMapDataSource.cs
- StoreUtilities.cs
- CatalogZone.cs
- ListViewSortEventArgs.cs
- ProgramPublisher.cs
- Span.cs
- PaperSource.cs
- SoapReflectionImporter.cs
- SapiRecoInterop.cs
- XmlReturnWriter.cs
- ConsoleKeyInfo.cs
- HTMLTextWriter.cs
- SerializationInfo.cs
- InfoCardRSACryptoProvider.cs
- ActiveXHost.cs
- storepermissionattribute.cs
- HtmlShim.cs
- SignedPkcs7.cs
- ListItemConverter.cs
- SmtpMail.cs
- PersianCalendar.cs
- MatrixTransform3D.cs
- PieceDirectory.cs
- DataErrorValidationRule.cs
- FrameworkElement.cs
- ClientViaElement.cs
- ToolStripTextBox.cs
- TemplatePropertyEntry.cs
- ButtonPopupAdapter.cs
- PieceNameHelper.cs
- OdbcReferenceCollection.cs
- CodeDOMUtility.cs
- TaiwanLunisolarCalendar.cs
- TrustLevel.cs
- ViewStateModeByIdAttribute.cs
- AuthenticationModulesSection.cs
- AbstractExpressions.cs
- XmlCharCheckingReader.cs