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
- FolderBrowserDialog.cs
- ByteStack.cs
- QueryOutputWriter.cs
- DataContractSerializer.cs
- ResizeBehavior.cs
- ListItemCollection.cs
- TreePrinter.cs
- WebUtil.cs
- WebPartCollection.cs
- SiteMapPath.cs
- AppSettingsReader.cs
- TextRangeEdit.cs
- SoapAttributes.cs
- ValidatorCollection.cs
- PolicyStatement.cs
- InternalResources.cs
- CodeArgumentReferenceExpression.cs
- EntityRecordInfo.cs
- QilVisitor.cs
- CompilationPass2Task.cs
- HtmlLiteralTextAdapter.cs
- QuadraticBezierSegment.cs
- DataSourceXmlSubItemAttribute.cs
- CodeNamespace.cs
- PowerStatus.cs
- HwndTarget.cs
- ExtenderProvidedPropertyAttribute.cs
- Rect.cs
- CompModSwitches.cs
- UInt32.cs
- LinqDataSourceHelper.cs
- ConnectionManagementSection.cs
- AdCreatedEventArgs.cs
- HttpRawResponse.cs
- StreamSecurityUpgradeInitiator.cs
- SimpleLine.cs
- DescendantOverDescendantQuery.cs
- Journal.cs
- ErrorProvider.cs
- EntityTemplateUserControl.cs
- ApplicationManager.cs
- SwitchAttribute.cs
- SqlDataSource.cs
- SettingsProperty.cs
- BitmapEffectCollection.cs
- PublisherMembershipCondition.cs
- SelectionItemProviderWrapper.cs
- LambdaCompiler.Statements.cs
- URLMembershipCondition.cs
- fixedPageContentExtractor.cs
- PlacementWorkspace.cs
- DataViewManager.cs
- SubpageParaClient.cs
- SrgsElementFactoryCompiler.cs
- DetailsViewAutoFormat.cs
- InkCanvas.cs
- CodeObject.cs
- AttributeCollection.cs
- RequestCacheEntry.cs
- RoleManagerModule.cs
- DifferencingCollection.cs
- LoadGrammarCompletedEventArgs.cs
- CatchDesigner.xaml.cs
- CompilerGlobalScopeAttribute.cs
- MenuScrollingVisibilityConverter.cs
- InputMethod.cs
- TextSelectionHelper.cs
- CompilationLock.cs
- ToolStripDropTargetManager.cs
- InvalidateEvent.cs
- ValidationPropertyAttribute.cs
- StringDictionary.cs
- FullTrustAssembliesSection.cs
- ConnectionProviderAttribute.cs
- LinkedResourceCollection.cs
- EntityDataSourceWrapperCollection.cs
- WebFormsRootDesigner.cs
- RegistrySecurity.cs
- fixedPageContentExtractor.cs
- MediaElement.cs
- WebPartCollection.cs
- XPathAncestorQuery.cs
- Int32RectValueSerializer.cs
- ArgIterator.cs
- SizeLimitedCache.cs
- LocalBuilder.cs
- CellLabel.cs
- TakeOrSkipWhileQueryOperator.cs
- BamlResourceContent.cs
- ApplicationFileCodeDomTreeGenerator.cs
- DateTimePicker.cs
- OdbcEnvironment.cs
- ClientConfigurationHost.cs
- MetadataArtifactLoaderCompositeFile.cs
- XmlReaderDelegator.cs
- MachineKeyConverter.cs
- ElementNotEnabledException.cs
- ResourceWriter.cs
- KeySpline.cs
- ParserContext.cs