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
- SubtreeProcessor.cs
- _ProxyChain.cs
- _UriTypeConverter.cs
- Pen.cs
- precedingsibling.cs
- BasicViewGenerator.cs
- Function.cs
- ChangeProcessor.cs
- RangeValueProviderWrapper.cs
- OpenTypeLayoutCache.cs
- FontCollection.cs
- DragEventArgs.cs
- Wrapper.cs
- Task.cs
- CssClassPropertyAttribute.cs
- TreeViewItemAutomationPeer.cs
- ProxyWebPartConnectionCollection.cs
- ReferenceEqualityComparer.cs
- Utils.cs
- SystemMulticastIPAddressInformation.cs
- ReachPrintTicketSerializer.cs
- DbConnectionOptions.cs
- ExecutionScope.cs
- SetterBaseCollection.cs
- ConfigXmlComment.cs
- TypedMessageConverter.cs
- ReferencedType.cs
- SqlDataReaderSmi.cs
- Pen.cs
- ResourceDictionaryCollection.cs
- Misc.cs
- BackStopAuthenticationModule.cs
- RawStylusActions.cs
- GridViewRowCollection.cs
- ExportOptions.cs
- ClientTargetSection.cs
- PagedDataSource.cs
- translator.cs
- WebControlAdapter.cs
- OptimalTextSource.cs
- AstTree.cs
- ExtensibleClassFactory.cs
- XmlComplianceUtil.cs
- BrushConverter.cs
- MsmqIntegrationChannelListener.cs
- WebPartPersonalization.cs
- CryptoKeySecurity.cs
- OutputBuffer.cs
- TypeDelegator.cs
- StoragePropertyMapping.cs
- ChannelServices.cs
- DatePickerDateValidationErrorEventArgs.cs
- webproxy.cs
- AdRotator.cs
- SchemaImporterExtensionElement.cs
- DynamicFilterExpression.cs
- ThrowHelper.cs
- Boolean.cs
- CreateRefExpr.cs
- EmptyStringExpandableObjectConverter.cs
- ToolStripDropDownItem.cs
- IntellisenseTextBox.designer.cs
- XmlSchemaAll.cs
- ExpressionBuilderContext.cs
- LinkedResource.cs
- TransportContext.cs
- MimeImporter.cs
- ClientRolePrincipal.cs
- UrlMappingsModule.cs
- EdmFunction.cs
- CharStorage.cs
- ColorMatrix.cs
- ServiceBusyException.cs
- ControlPaint.cs
- SqlDataSourceFilteringEventArgs.cs
- FontCacheUtil.cs
- FontStretches.cs
- ListBase.cs
- RawUIStateInputReport.cs
- WindowsComboBox.cs
- VectorAnimationBase.cs
- WindowsStartMenu.cs
- WindowsTokenRoleProvider.cs
- EntityType.cs
- ProcessHostFactoryHelper.cs
- DefaultMemberAttribute.cs
- ServiceNameElement.cs
- EventLogPermission.cs
- CommonDialog.cs
- DefaultValueTypeConverter.cs
- VisualBasicSettingsHandler.cs
- SqlNotificationRequest.cs
- ConnectorRouter.cs
- CachingHintValidation.cs
- NodeFunctions.cs
- StringToken.cs
- GridViewRowCollection.cs
- HyperLinkColumn.cs
- PostBackOptions.cs
- Rect3D.cs