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
- FileResponseElement.cs
- CodeCatchClause.cs
- TextTreeText.cs
- BaseComponentEditor.cs
- TextBreakpoint.cs
- AuthorizationRuleCollection.cs
- X509WindowsSecurityToken.cs
- HtmlShim.cs
- TableColumnCollectionInternal.cs
- WebPartsPersonalizationAuthorization.cs
- SplineKeyFrames.cs
- WindowsStartMenu.cs
- TextTreeRootNode.cs
- WebPartsPersonalizationAuthorization.cs
- AnnotationService.cs
- DialogDivider.cs
- CodeAssignStatement.cs
- OleDbErrorCollection.cs
- DiagnosticsConfigurationHandler.cs
- LambdaCompiler.Binary.cs
- CopyCodeAction.cs
- TextServicesContext.cs
- DrawToolTipEventArgs.cs
- SocketElement.cs
- WindowsFormsHost.cs
- ButtonColumn.cs
- KnownColorTable.cs
- DesigntimeLicenseContext.cs
- ExpressionEditorAttribute.cs
- HexParser.cs
- InstanceKeyCollisionException.cs
- TogglePatternIdentifiers.cs
- ArrayConverter.cs
- BuildProviderCollection.cs
- EntityContainer.cs
- TypefaceMap.cs
- CryptoConfig.cs
- MSAAWinEventWrap.cs
- WebPartDeleteVerb.cs
- SimpleTableProvider.cs
- QilName.cs
- Debug.cs
- DataObjectAttribute.cs
- HtmlButton.cs
- DispatcherFrame.cs
- XmlAggregates.cs
- NativeMethods.cs
- translator.cs
- XmlQueryStaticData.cs
- ColorPalette.cs
- EventToken.cs
- CookielessData.cs
- MediaElementAutomationPeer.cs
- StringFormat.cs
- RootBrowserWindowAutomationPeer.cs
- PropertyManager.cs
- COM2ColorConverter.cs
- XamlInterfaces.cs
- BufferedReceiveElement.cs
- RowVisual.cs
- SoundPlayer.cs
- CmsInterop.cs
- NetworkInterface.cs
- SspiHelper.cs
- StretchValidation.cs
- PropertyGridView.cs
- AssemblyInfo.cs
- Decoder.cs
- MailAddress.cs
- PolygonHotSpot.cs
- XmlNullResolver.cs
- ImageMapEventArgs.cs
- DatePicker.cs
- XmlSubtreeReader.cs
- TransactionManager.cs
- MessageQueueCriteria.cs
- PlanCompiler.cs
- GroupDescription.cs
- XmlProcessingInstruction.cs
- LicenseContext.cs
- HttpListener.cs
- CodeGenerator.cs
- LocalFileSettingsProvider.cs
- PageCache.cs
- SapiRecoContext.cs
- AccessViolationException.cs
- XmlUrlResolver.cs
- ReadOnlyDictionary.cs
- FlowNode.cs
- DoubleKeyFrameCollection.cs
- ComponentResourceKeyConverter.cs
- ProcessModelSection.cs
- AxHost.cs
- SettingsPropertyWrongTypeException.cs
- Certificate.cs
- SetterBaseCollection.cs
- XmlTextReaderImplHelpers.cs
- DiscoveryInnerClientAdhoc11.cs
- ZipIOFileItemStream.cs
- RtfControls.cs