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
- FormClosedEvent.cs
- XPathDocumentNavigator.cs
- DbMetaDataColumnNames.cs
- ReverseInheritProperty.cs
- GridToolTip.cs
- SqlStream.cs
- _AutoWebProxyScriptWrapper.cs
- ExtendedPropertyDescriptor.cs
- NavigationProperty.cs
- EntityDataSource.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- DesignerOptionService.cs
- FixedDocumentPaginator.cs
- FlowLayoutPanel.cs
- MouseDevice.cs
- HttpsChannelListener.cs
- UriTemplateEquivalenceComparer.cs
- TraceXPathNavigator.cs
- XmlUTF8TextReader.cs
- FormViewDeleteEventArgs.cs
- HWStack.cs
- HtmlInputReset.cs
- IncrementalCompileAnalyzer.cs
- SiteMapProvider.cs
- Validator.cs
- DecoderFallbackWithFailureFlag.cs
- CompressStream.cs
- SecurityContext.cs
- FlowLayoutSettings.cs
- Int32Rect.cs
- CroppedBitmap.cs
- XmlEntityReference.cs
- DataSourceHelper.cs
- EntitySqlQueryBuilder.cs
- ImportCatalogPart.cs
- ParseElementCollection.cs
- EpmContentDeSerializerBase.cs
- RightsManagementPermission.cs
- PageClientProxyGenerator.cs
- TdsParameterSetter.cs
- TypeReference.cs
- TableProviderWrapper.cs
- MemoryRecordBuffer.cs
- TextEndOfSegment.cs
- ExpressionBindingCollection.cs
- CreateUserWizardStep.cs
- DesignSurfaceEvent.cs
- EventMap.cs
- RedistVersionInfo.cs
- PtsContext.cs
- ProcessProtocolHandler.cs
- ParallelTimeline.cs
- PageThemeBuildProvider.cs
- CharacterMetricsDictionary.cs
- SessionStateModule.cs
- XmlIgnoreAttribute.cs
- GotoExpression.cs
- TypeSystem.cs
- ContainerSelectorGlyph.cs
- WorkerRequest.cs
- FragmentNavigationEventArgs.cs
- SQLRoleProvider.cs
- TcpHostedTransportConfiguration.cs
- DayRenderEvent.cs
- PlaceHolder.cs
- WorkerRequest.cs
- RuleRef.cs
- SessionPageStateSection.cs
- SecondaryViewProvider.cs
- CacheManager.cs
- PerspectiveCamera.cs
- UIPropertyMetadata.cs
- DataListItemCollection.cs
- TableLayoutColumnStyleCollection.cs
- SystemWebSectionGroup.cs
- CustomCategoryAttribute.cs
- VisualBasicSettingsHandler.cs
- MarkupCompilePass2.cs
- IndependentlyAnimatedPropertyMetadata.cs
- MetadataCache.cs
- WebConfigurationFileMap.cs
- SessionParameter.cs
- DataGridViewBand.cs
- VisualBrush.cs
- XmlSchemaComplexContentExtension.cs
- InheritanceContextChangedEventManager.cs
- Baml2006KnownTypes.cs
- WebBrowserBase.cs
- Transform3D.cs
- Component.cs
- FixedLineResult.cs
- DataRow.cs
- EarlyBoundInfo.cs
- TransactionChannelFaultConverter.cs
- ClipboardData.cs
- SiteMapHierarchicalDataSourceView.cs
- WsiProfilesElement.cs
- EncryptedKey.cs
- MessageLogger.cs
- VisualStyleElement.cs