Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / infocard / Client / System / IdentityModel / Selectors / SafeTokenHandle.cs / 1305376 / SafeTokenHandle.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Selectors { using System; using System.Runtime.InteropServices; using System.Runtime.ConstrainedExecution; using System.Security; // // Summary: // Provides a wrapper over the generic xml token returned from the native client // internal class SafeTokenHandle : SafeHandle { [DllImport( "infocardapi.dll", EntryPoint ="FreeToken", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall, ExactSpelling = true, SetLastError = true ) ] [SuppressUnmanagedCodeSecurity] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern System.Int32 FreeToken( [In] IntPtr token ); private SafeTokenHandle() : base( IntPtr.Zero, true ) { } public override bool IsInvalid { get { return ( IntPtr.Zero == base.handle ); } } protected override bool ReleaseHandle() { #pragma warning suppress 56523 return ( 0 == FreeToken( base.handle ) ) ? false : true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Selectors { using System; using System.Runtime.InteropServices; using System.Runtime.ConstrainedExecution; using System.Security; // // Summary: // Provides a wrapper over the generic xml token returned from the native client // internal class SafeTokenHandle : SafeHandle { [DllImport( "infocardapi.dll", EntryPoint ="FreeToken", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall, ExactSpelling = true, SetLastError = true ) ] [SuppressUnmanagedCodeSecurity] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern System.Int32 FreeToken( [In] IntPtr token ); private SafeTokenHandle() : base( IntPtr.Zero, true ) { } public override bool IsInvalid { get { return ( IntPtr.Zero == base.handle ); } } protected override bool ReleaseHandle() { #pragma warning suppress 56523 return ( 0 == FreeToken( base.handle ) ) ? false : 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
- Msec.cs
- XmlDeclaration.cs
- PassportAuthentication.cs
- SqlPersonalizationProvider.cs
- PkcsMisc.cs
- KnownBoxes.cs
- ActivityExecutorSurrogate.cs
- ComUdtElementCollection.cs
- FlowThrottle.cs
- BindingContext.cs
- ColumnMapCopier.cs
- HuffModule.cs
- XmlSchemaExporter.cs
- RuntimeTransactionHandle.cs
- ClrProviderManifest.cs
- Int16Animation.cs
- TemplateBuilder.cs
- SettingsPropertyNotFoundException.cs
- SerialPinChanges.cs
- QilChoice.cs
- QueryGeneratorBase.cs
- EnterpriseServicesHelper.cs
- TCEAdapterGenerator.cs
- SelectionChangedEventArgs.cs
- SafeProcessHandle.cs
- ReaderWriterLockWrapper.cs
- TableLayoutSettingsTypeConverter.cs
- login.cs
- CustomLineCap.cs
- MSAANativeProvider.cs
- GraphicsContainer.cs
- DataTrigger.cs
- NonClientArea.cs
- BaseComponentEditor.cs
- Constants.cs
- WebBrowserDesigner.cs
- TabControlAutomationPeer.cs
- InvalidOleVariantTypeException.cs
- ProgressBarBrushConverter.cs
- RefreshEventArgs.cs
- StyleXamlParser.cs
- WorkflowInstance.cs
- ExpressionBindings.cs
- SystemNetworkInterface.cs
- BitmapEffectState.cs
- WebPartConnection.cs
- _UriTypeConverter.cs
- User.cs
- EntityViewGenerationAttribute.cs
- ReferentialConstraint.cs
- DeferredSelectedIndexReference.cs
- DataGridViewToolTip.cs
- CompilerWrapper.cs
- NonBatchDirectoryCompiler.cs
- CreateRefExpr.cs
- Pen.cs
- RbTree.cs
- ColumnResizeAdorner.cs
- Inline.cs
- PageClientProxyGenerator.cs
- ServiceDesigner.cs
- SizeConverter.cs
- DataGridItem.cs
- WizardForm.cs
- SchemaObjectWriter.cs
- CompatibleIComparer.cs
- PersonalizableAttribute.cs
- TextFindEngine.cs
- DragCompletedEventArgs.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- SynchronizationFilter.cs
- ComAdminWrapper.cs
- XamlNamespaceHelper.cs
- ApplicationDirectory.cs
- ExecutionEngineException.cs
- CodeGotoStatement.cs
- FixedSOMSemanticBox.cs
- ScrollBar.cs
- HideDisabledControlAdapter.cs
- MarkupExtensionParser.cs
- SoapMessage.cs
- XmlQueryTypeFactory.cs
- EdmValidator.cs
- HttpResponseInternalWrapper.cs
- EmbeddedMailObject.cs
- ToolStripManager.cs
- IdentifierService.cs
- PrintDocument.cs
- BuildProviderAppliesToAttribute.cs
- AbstractDataSvcMapFileLoader.cs
- ServiceOperationInfoTypeConverter.cs
- COM2IDispatchConverter.cs
- Keyboard.cs
- DefaultAsyncDataDispatcher.cs
- ObjectAnimationUsingKeyFrames.cs
- ColumnCollectionEditor.cs
- ConfigPathUtility.cs
- Visitor.cs
- AdornedElementPlaceholder.cs
- Utils.cs