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
- TableLayoutSettingsTypeConverter.cs
- RoutedEventArgs.cs
- CaseStatementProjectedSlot.cs
- ToolStripMenuItem.cs
- COMException.cs
- HttpApplicationStateBase.cs
- BigInt.cs
- InkCanvasFeedbackAdorner.cs
- SystemIcons.cs
- ProcessThread.cs
- PropertyIdentifier.cs
- StylusButtonCollection.cs
- ColorTranslator.cs
- WhitespaceRuleLookup.cs
- MultipartContentParser.cs
- ProxyHelper.cs
- DynamicResourceExtension.cs
- ServiceModelInstallComponent.cs
- ImageClickEventArgs.cs
- WindowsSolidBrush.cs
- RelationshipNavigation.cs
- PointF.cs
- DataServiceRequestException.cs
- DataSpaceManager.cs
- DiagnosticTrace.cs
- SiteMapNodeCollection.cs
- ReadWriteSpinLock.cs
- InputMethodStateChangeEventArgs.cs
- UpdateInfo.cs
- LogLogRecordEnumerator.cs
- EncoderExceptionFallback.cs
- ResourceContainer.cs
- DataListComponentEditor.cs
- XmlWrappingReader.cs
- mil_sdk_version.cs
- VectorAnimation.cs
- Label.cs
- DocumentViewerConstants.cs
- InheritanceContextHelper.cs
- ZipIOExtraFieldElement.cs
- GroupByQueryOperator.cs
- WindowCollection.cs
- XamlTemplateSerializer.cs
- InkCanvasFeedbackAdorner.cs
- DbConnectionPool.cs
- PropertyNames.cs
- XmlSchemaSubstitutionGroup.cs
- DrawingAttributes.cs
- Binding.cs
- LogSwitch.cs
- EntityClassGenerator.cs
- Errors.cs
- DocumentCollection.cs
- AssemblyBuilderData.cs
- __TransparentProxy.cs
- ConnectorSelectionGlyph.cs
- AssociativeAggregationOperator.cs
- Reference.cs
- SQLSingleStorage.cs
- UrlPath.cs
- SystemFonts.cs
- WCFBuildProvider.cs
- MetaModel.cs
- InvalidComObjectException.cs
- DbXmlEnabledProviderManifest.cs
- TimeZone.cs
- MemberInfoSerializationHolder.cs
- Floater.cs
- StorageInfo.cs
- XmlTextWriter.cs
- DesignOnlyAttribute.cs
- ObjectTag.cs
- DataServiceQueryException.cs
- HighlightVisual.cs
- StorageFunctionMapping.cs
- CommandDevice.cs
- streamingZipPartStream.cs
- DataServiceExpressionVisitor.cs
- RtType.cs
- RijndaelManaged.cs
- Lease.cs
- LayoutEngine.cs
- CheckedPointers.cs
- CompModSwitches.cs
- DataGridColumnEventArgs.cs
- AnimationStorage.cs
- WorkflowMarkupSerializationProvider.cs
- UTF7Encoding.cs
- OleDbParameterCollection.cs
- StateInitialization.cs
- Propagator.JoinPropagator.SubstitutingCloneVisitor.cs
- PartialCachingAttribute.cs
- SimpleRecyclingCache.cs
- ExpressionsCollectionConverter.cs
- RoleService.cs
- StrongNameIdentityPermission.cs
- MobileRedirect.cs
- HttpResponse.cs
- SpecularMaterial.cs
- SoapIncludeAttribute.cs