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
- WizardPanel.cs
- CompilationUtil.cs
- TextSpan.cs
- PnrpPermission.cs
- TemplateControl.cs
- EventEntry.cs
- DefaultValidator.cs
- UIHelper.cs
- PermissionToken.cs
- BitmapSource.cs
- __Filters.cs
- Typeface.cs
- StaticResourceExtension.cs
- CachedCompositeFamily.cs
- ColorInterpolationModeValidation.cs
- HostedNamedPipeTransportManager.cs
- DataServiceException.cs
- Stack.cs
- TileBrush.cs
- XamlToRtfWriter.cs
- UnsafeNativeMethods.cs
- Quad.cs
- ZipIOCentralDirectoryFileHeader.cs
- AbsoluteQuery.cs
- DateTimeConverter2.cs
- SqlOuterApplyReducer.cs
- BitmapCodecInfoInternal.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- LineProperties.cs
- AppSettingsExpressionBuilder.cs
- StylusPoint.cs
- PropertyCollection.cs
- DesignerMetadata.cs
- RealizationDrawingContextWalker.cs
- XmlAnyElementAttribute.cs
- XPathAncestorQuery.cs
- Delay.cs
- JapaneseLunisolarCalendar.cs
- XLinq.cs
- SslStreamSecurityElement.cs
- MexHttpsBindingElement.cs
- EntityContainerAssociationSet.cs
- TextAdaptor.cs
- CodePropertyReferenceExpression.cs
- XmlAttributes.cs
- MessageContractAttribute.cs
- QueryLifecycle.cs
- DuplexChannelFactory.cs
- ColorContextHelper.cs
- MatchAllMessageFilter.cs
- RegexBoyerMoore.cs
- WpfXamlLoader.cs
- Brushes.cs
- SchemaComplexType.cs
- ColorConvertedBitmapExtension.cs
- DataFormat.cs
- UpdateManifestForBrowserApplication.cs
- DialogDivider.cs
- SQLSingleStorage.cs
- PowerModeChangedEventArgs.cs
- _BaseOverlappedAsyncResult.cs
- PerformanceCounterCategory.cs
- StreamWithDictionary.cs
- _ProxyChain.cs
- FontDialog.cs
- FacetChecker.cs
- RightsManagementLicense.cs
- InputReportEventArgs.cs
- SecurityKeyType.cs
- CodeLabeledStatement.cs
- TypeEnumerableViewSchema.cs
- SchemaSetCompiler.cs
- HttpRequestCacheValidator.cs
- RowToFieldTransformer.cs
- VideoDrawing.cs
- WriteableOnDemandStream.cs
- TextAdaptor.cs
- PrintingPermission.cs
- TreeNodeStyleCollectionEditor.cs
- ReadOnlyHierarchicalDataSource.cs
- IxmlLineInfo.cs
- EntityContainerEmitter.cs
- DataListItemCollection.cs
- ShutDownListener.cs
- NetTcpBindingCollectionElement.cs
- StringSorter.cs
- JsonServiceDocumentSerializer.cs
- Part.cs
- FileSystemEnumerable.cs
- DefaultMemberAttribute.cs
- SessionStateItemCollection.cs
- NoneExcludedImageIndexConverter.cs
- XmlComment.cs
- TextClipboardData.cs
- ComboBox.cs
- HttpPostLocalhostServerProtocol.cs
- WebSysDefaultValueAttribute.cs
- ApplicationActivator.cs
- AsyncCompletedEventArgs.cs
- FormViewUpdateEventArgs.cs