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
- OdbcRowUpdatingEvent.cs
- TextModifier.cs
- Size3DValueSerializer.cs
- SpotLight.cs
- StylusDownEventArgs.cs
- Walker.cs
- GeneralTransform.cs
- InteropAutomationProvider.cs
- _NativeSSPI.cs
- BindingExpression.cs
- AliasExpr.cs
- BehaviorEditorPart.cs
- SelectionChangedEventArgs.cs
- SQLInt16Storage.cs
- UmAlQuraCalendar.cs
- DeviceContext2.cs
- CqlParserHelpers.cs
- Transform.cs
- WhiteSpaceTrimStringConverter.cs
- StrokeCollection.cs
- StringComparer.cs
- ConfigXmlWhitespace.cs
- TextEvent.cs
- XsltArgumentList.cs
- DataExchangeServiceBinder.cs
- RuntimeCompatibilityAttribute.cs
- GACMembershipCondition.cs
- CheckBox.cs
- dataprotectionpermission.cs
- ObservableCollectionDefaultValueFactory.cs
- TransformValueSerializer.cs
- StateItem.cs
- ISO2022Encoding.cs
- SafeRightsManagementQueryHandle.cs
- HostExecutionContextManager.cs
- InsufficientMemoryException.cs
- LogEntryUtils.cs
- ProcessHostMapPath.cs
- XPathBinder.cs
- ClipboardProcessor.cs
- InputLangChangeRequestEvent.cs
- CacheVirtualItemsEvent.cs
- SqlUdtInfo.cs
- ProviderConnectionPoint.cs
- XmlName.cs
- IsolatedStorageException.cs
- MachineKeySection.cs
- CheckBoxPopupAdapter.cs
- WindowsSolidBrush.cs
- XmlChoiceIdentifierAttribute.cs
- SoapMessage.cs
- Int64Storage.cs
- XmlCustomFormatter.cs
- MeasureData.cs
- EventLog.cs
- IsolatedStorage.cs
- XPathNavigator.cs
- SystemFonts.cs
- SelectionPatternIdentifiers.cs
- AvtEvent.cs
- MessageBox.cs
- ImageListImage.cs
- WriteFileContext.cs
- PageContentAsyncResult.cs
- odbcmetadatacolumnnames.cs
- ImageSourceConverter.cs
- PropertyToken.cs
- BaseParaClient.cs
- HoistedLocals.cs
- _SslSessionsCache.cs
- ReadOnlyCollectionBase.cs
- MatrixTransform.cs
- CultureSpecificCharacterBufferRange.cs
- DataPointer.cs
- Span.cs
- SecurityRuntime.cs
- PermissionSetEnumerator.cs
- ZipIOCentralDirectoryFileHeader.cs
- TextClipboardData.cs
- FixedTextSelectionProcessor.cs
- XmlDataImplementation.cs
- SimpleType.cs
- AutomationTextAttribute.cs
- AnnouncementClient.cs
- DbConnectionClosed.cs
- WebPartDisplayModeEventArgs.cs
- Exceptions.cs
- RightsManagementPermission.cs
- PenLineJoinValidation.cs
- UIAgentMonitorHandle.cs
- CapabilitiesUse.cs
- Stylus.cs
- ScriptBehaviorDescriptor.cs
- DeferredSelectedIndexReference.cs
- InternalCache.cs
- ScriptComponentDescriptor.cs
- FormatPage.cs
- TypeConverter.cs
- WindowsHyperlink.cs
- GridViewRowEventArgs.cs