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
- CommandDevice.cs
- BufferedGraphicsManager.cs
- SettingsAttributes.cs
- IdnElement.cs
- IdnMapping.cs
- CacheOutputQuery.cs
- DispatcherFrame.cs
- WindowsScrollBar.cs
- DynamicPropertyHolder.cs
- HelloOperationAsyncResult.cs
- WindowsFormsSectionHandler.cs
- DataBinder.cs
- StructuralType.cs
- SystemColors.cs
- ToolStripContentPanel.cs
- EventManager.cs
- ErrorTableItemStyle.cs
- Properties.cs
- DesignBindingPropertyDescriptor.cs
- MenuItemBinding.cs
- EditorPart.cs
- ItemAutomationPeer.cs
- documentsequencetextpointer.cs
- AxisAngleRotation3D.cs
- InstanceValue.cs
- DefaultProfileManager.cs
- ReceiveActivityDesigner.cs
- PathGeometry.cs
- CapabilitiesAssignment.cs
- DataObjectCopyingEventArgs.cs
- PersistChildrenAttribute.cs
- StorageComplexTypeMapping.cs
- PrinterSettings.cs
- TextControl.cs
- GenericArgumentsUpdater.cs
- ClonableStack.cs
- SystemNetworkInterface.cs
- RouteParameter.cs
- ButtonStandardAdapter.cs
- BitmapImage.cs
- EnvironmentPermission.cs
- DatagramAdapter.cs
- XhtmlBasicFormAdapter.cs
- EntityParameterCollection.cs
- NumberFormatInfo.cs
- ManipulationStartedEventArgs.cs
- SettingsPropertyCollection.cs
- ServerIdentity.cs
- ProjectionCamera.cs
- DynamicArgumentDialog.cs
- AxParameterData.cs
- CatalogZoneBase.cs
- ArgIterator.cs
- WebPartConnectionsDisconnectVerb.cs
- SchemeSettingElement.cs
- StyleModeStack.cs
- ProfileSettings.cs
- IProvider.cs
- Queue.cs
- MsmqIntegrationBindingElement.cs
- Base64Stream.cs
- ProtocolsConfigurationHandler.cs
- SplitterPanel.cs
- PenLineJoinValidation.cs
- SecurityTokenRequirement.cs
- sqlser.cs
- GridViewItemAutomationPeer.cs
- BrowserDefinition.cs
- MergeFilterQuery.cs
- BitmapCacheBrush.cs
- WizardPanel.cs
- StructuredTypeEmitter.cs
- MimeXmlImporter.cs
- CodeIndexerExpression.cs
- XamlStream.cs
- ProfileBuildProvider.cs
- WindowsListViewItemStartMenu.cs
- TableRowsCollectionEditor.cs
- RemotingException.cs
- TaiwanCalendar.cs
- DataBoundControlDesigner.cs
- CheckPair.cs
- ValidatedControlConverter.cs
- ScriptResourceAttribute.cs
- SelectionGlyph.cs
- BuiltInPermissionSets.cs
- DataTableMapping.cs
- Baml2006SchemaContext.cs
- SpecularMaterial.cs
- Matrix3DConverter.cs
- VirtualDirectoryMappingCollection.cs
- Int64Animation.cs
- DataTableNewRowEvent.cs
- EncoderExceptionFallback.cs
- _SslStream.cs
- ConfigDefinitionUpdates.cs
- StartFileNameEditor.cs
- BitmapFrameEncode.cs
- ResourceAssociationSetEnd.cs
- GlyphShapingProperties.cs