Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Win32 / SafeHandles / safePerfProviderHandle.cs / 1305376 / safePerfProviderHandle.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace Microsoft.Win32.SafeHandles { using System; using System.Threading; using System.Diagnostics; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; //// #pragma warning disable 618 // Have not migrated to v4 transparency yet [System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)] #pragma warning restore 618 internal sealed class SafePerfProviderHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafePerfProviderHandle() : base(true) {} protected override bool ReleaseHandle() { IntPtr tempProviderHandle = handle; if (Interlocked.Exchange(ref handle, IntPtr.Zero) != IntPtr.Zero) { uint Status = UnsafeNativeMethods.PerfStopProvider(tempProviderHandle); Debug.Assert(Status == (uint)UnsafeNativeMethods.ERROR_SUCCESS, "PerfStopProvider() fails"); // ERROR_INVALID_PARAMETER } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace Microsoft.Win32.SafeHandles { using System; using System.Threading; using System.Diagnostics; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; //// #pragma warning disable 618 // Have not migrated to v4 transparency yet [System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)] #pragma warning restore 618 internal sealed class SafePerfProviderHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafePerfProviderHandle() : base(true) {} protected override bool ReleaseHandle() { IntPtr tempProviderHandle = handle; if (Interlocked.Exchange(ref handle, IntPtr.Zero) != IntPtr.Zero) { uint Status = UnsafeNativeMethods.PerfStopProvider(tempProviderHandle); Debug.Assert(Status == (uint)UnsafeNativeMethods.ERROR_SUCCESS, "PerfStopProvider() fails"); // ERROR_INVALID_PARAMETER } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.//
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OperandQuery.cs
- PkcsMisc.cs
- MouseButtonEventArgs.cs
- ImageSource.cs
- ResizeGrip.cs
- RolePrincipal.cs
- XmlSchemaAttributeGroupRef.cs
- Section.cs
- LayoutExceptionEventArgs.cs
- PathTooLongException.cs
- SQLDateTime.cs
- Scanner.cs
- ActivityDesignerResources.cs
- CssClassPropertyAttribute.cs
- Parameter.cs
- TemplatedAdorner.cs
- OperatorExpressions.cs
- AsymmetricSignatureFormatter.cs
- MasterPageParser.cs
- Hex.cs
- Size3DConverter.cs
- IPEndPointCollection.cs
- HtmlDocument.cs
- RowToFieldTransformer.cs
- XPathPatternBuilder.cs
- Version.cs
- DoubleAnimationUsingPath.cs
- NavigationWindow.cs
- ApplicationSecurityInfo.cs
- SparseMemoryStream.cs
- DetailsViewRow.cs
- AutomationElementIdentifiers.cs
- BitConverter.cs
- FramingEncoders.cs
- MenuItem.cs
- ColorTranslator.cs
- StyleBamlRecordReader.cs
- CallbackValidatorAttribute.cs
- PageWrapper.cs
- HttpCachePolicy.cs
- UserValidatedEventArgs.cs
- Point4D.cs
- ObjectSet.cs
- ListBoxChrome.cs
- SessionStateUtil.cs
- SmiEventSink_DeferedProcessing.cs
- BaseTemplateCodeDomTreeGenerator.cs
- GridViewDeletedEventArgs.cs
- XmlAttributeAttribute.cs
- Validator.cs
- VScrollBar.cs
- FileDetails.cs
- BaseDataBoundControl.cs
- COM2IDispatchConverter.cs
- SystemBrushes.cs
- XmlnsCache.cs
- ZipIOCentralDirectoryFileHeader.cs
- ServiceInfo.cs
- processwaithandle.cs
- XsltException.cs
- XamlSerializerUtil.cs
- HasCopySemanticsAttribute.cs
- ControlBuilder.cs
- AnimationException.cs
- EventProviderBase.cs
- BlobPersonalizationState.cs
- DirtyTextRange.cs
- ConfigurationProviderException.cs
- DeferrableContent.cs
- HebrewNumber.cs
- login.cs
- BinaryConverter.cs
- FormViewDeletedEventArgs.cs
- KeyValueConfigurationElement.cs
- ClosableStream.cs
- BindToObject.cs
- nulltextnavigator.cs
- TaskHelper.cs
- GeometryDrawing.cs
- CursorInteropHelper.cs
- QueryOperatorEnumerator.cs
- WindowsFormsSynchronizationContext.cs
- basecomparevalidator.cs
- SHA384Managed.cs
- TimeStampChecker.cs
- WebPartAddingEventArgs.cs
- Rect3DConverter.cs
- ByteStack.cs
- GenericIdentity.cs
- NameSpaceExtractor.cs
- HeaderCollection.cs
- DataStreams.cs
- DataKey.cs
- PathFigureCollectionConverter.cs
- IntSecurity.cs
- VisualStyleTypesAndProperties.cs
- TagPrefixAttribute.cs
- DataList.cs
- ServicePoint.cs
- DataColumnMapping.cs