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
- NetStream.cs
- ObjectSpanRewriter.cs
- httpserverutility.cs
- OledbConnectionStringbuilder.cs
- StringArrayEditor.cs
- XsltException.cs
- CodeCompiler.cs
- Int32KeyFrameCollection.cs
- Timer.cs
- DataServiceEntityAttribute.cs
- errorpatternmatcher.cs
- SimpleRecyclingCache.cs
- RegistryPermission.cs
- IProvider.cs
- AssemblyResolver.cs
- Dictionary.cs
- PinnedBufferMemoryStream.cs
- NamedPipeAppDomainProtocolHandler.cs
- DependencyObjectCodeDomSerializer.cs
- ApplicationSecurityInfo.cs
- Label.cs
- CodeIdentifiers.cs
- ScrollViewer.cs
- Hashtable.cs
- SettingsPropertyValueCollection.cs
- IndicFontClient.cs
- CheckBoxDesigner.cs
- WebPartsPersonalization.cs
- IntegerFacetDescriptionElement.cs
- BitmapMetadata.cs
- NamespaceExpr.cs
- cache.cs
- DelegateTypeInfo.cs
- SqlClientPermission.cs
- ConfigurationSectionGroup.cs
- LinearQuaternionKeyFrame.cs
- NeutralResourcesLanguageAttribute.cs
- SwitchDesigner.xaml.cs
- ServicePoint.cs
- TdsParser.cs
- WebSysDisplayNameAttribute.cs
- ComboBox.cs
- TemplatedWizardStep.cs
- LocalizationComments.cs
- MissingFieldException.cs
- MenuScrollingVisibilityConverter.cs
- EncodingTable.cs
- OptimalTextSource.cs
- ResourcesGenerator.cs
- SqlMethodAttribute.cs
- SystemResourceKey.cs
- TransformerTypeCollection.cs
- BlockingCollection.cs
- DoubleLinkList.cs
- DataTemplateSelector.cs
- ActivationServices.cs
- DynamicPropertyHolder.cs
- BinaryParser.cs
- securitymgrsite.cs
- ClientCultureInfo.cs
- StyleTypedPropertyAttribute.cs
- SoapFormatter.cs
- CacheSection.cs
- NavigatorOutput.cs
- SQLDecimalStorage.cs
- OleDbConnectionInternal.cs
- WindowsPen.cs
- SessionParameter.cs
- RandomNumberGenerator.cs
- _ContextAwareResult.cs
- RegularExpressionValidator.cs
- DrawingDrawingContext.cs
- IIS7UserPrincipal.cs
- BuildResult.cs
- TerminatorSinks.cs
- Serialization.cs
- TrackBarRenderer.cs
- ProcessMonitor.cs
- ExcCanonicalXml.cs
- PropertyGridView.cs
- OleDbParameterCollection.cs
- ViewStateModeByIdAttribute.cs
- Viewport3DVisual.cs
- TreeNodeCollection.cs
- XmlWrappingReader.cs
- ExpandCollapseIsCheckedConverter.cs
- DateTimeStorage.cs
- BaseCollection.cs
- Span.cs
- GroupItemAutomationPeer.cs
- WebPartDisplayModeEventArgs.cs
- LoginView.cs
- DtcInterfaces.cs
- MD5.cs
- WebServiceMethodData.cs
- EntityDataSourceContextCreatedEventArgs.cs
- ToolStripSeparator.cs
- SchemaMapping.cs
- SimpleType.cs
- VsPropertyGrid.cs