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
- DataBoundControlAdapter.cs
- validationstate.cs
- DeferredTextReference.cs
- LinkUtilities.cs
- Sql8ConformanceChecker.cs
- sqlstateclientmanager.cs
- DoneReceivingAsyncResult.cs
- AsymmetricKeyExchangeDeformatter.cs
- LogStore.cs
- BatchServiceHost.cs
- ToolStripLabel.cs
- TextRange.cs
- UxThemeWrapper.cs
- Model3DGroup.cs
- DtrList.cs
- RootBuilder.cs
- LabelEditEvent.cs
- ForceCopyBuildProvider.cs
- Pair.cs
- DockPanel.cs
- IsolatedStorageFile.cs
- XPathNodeInfoAtom.cs
- ByteStorage.cs
- TransactionFlowElement.cs
- WebCodeGenerator.cs
- XmlNodeList.cs
- EnumMember.cs
- IdentityHolder.cs
- TableDetailsCollection.cs
- ThreadStateException.cs
- TraceSection.cs
- ZoneButton.cs
- CustomErrorsSection.cs
- BitStack.cs
- XPathSelectionIterator.cs
- ServiceOperationHelpers.cs
- RoleGroupCollection.cs
- SqlBuilder.cs
- TdsParserSafeHandles.cs
- RtfToXamlReader.cs
- ExpandoObject.cs
- MulticastOption.cs
- ParserStack.cs
- GenericUriParser.cs
- EventSourceCreationData.cs
- StylusLogic.cs
- Visual3D.cs
- DataSourceControl.cs
- ThreadInterruptedException.cs
- X509CertificateCollection.cs
- PolicyException.cs
- HeaderPanel.cs
- Visual3DCollection.cs
- Pointer.cs
- CellPartitioner.cs
- ReadWriteSpinLock.cs
- HttpServerUtilityBase.cs
- MouseGestureValueSerializer.cs
- ReservationCollection.cs
- PenLineJoinValidation.cs
- DataBindingExpressionBuilder.cs
- ResolveNameEventArgs.cs
- DesignParameter.cs
- ProfileBuildProvider.cs
- NodeFunctions.cs
- UnauthorizedAccessException.cs
- Setter.cs
- NetWebProxyFinder.cs
- securitycriticaldata.cs
- TableCellCollection.cs
- FormsAuthenticationCredentials.cs
- IgnoreSectionHandler.cs
- WindowProviderWrapper.cs
- TextTreeTextBlock.cs
- QueryHandler.cs
- DrawingAttributeSerializer.cs
- DiagnosticsConfigurationHandler.cs
- HtmlGenericControl.cs
- FileVersionInfo.cs
- ReadOnlyDictionary.cs
- NameValueConfigurationElement.cs
- MethodMessage.cs
- InkCanvasAutomationPeer.cs
- CustomAttributeBuilder.cs
- Fx.cs
- DescendantBaseQuery.cs
- AnnotationStore.cs
- NCryptNative.cs
- InvalidDocumentContentsException.cs
- FileChangeNotifier.cs
- MemberCollection.cs
- PageBreakRecord.cs
- SynthesizerStateChangedEventArgs.cs
- ClientOptions.cs
- ContextProperty.cs
- MediaScriptCommandRoutedEventArgs.cs
- BooleanFunctions.cs
- invalidudtexception.cs
- FormViewRow.cs
- SiteMapSection.cs