Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Configuration / Microsoft / Win32 / SafeCryptContextHandle.cs / 1 / SafeCryptContextHandle.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace Microsoft.Win32 {
using System;
using System.Security.Permissions;
using Microsoft.Win32.SafeHandles;
using System.Configuration;
// Safehandle for crypt context handles
[System.Security.SuppressUnmanagedCodeSecurityAttribute()]
internal sealed class SafeCryptContextHandle : SafeHandleZeroOrMinusOneIsInvalid {
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
internal SafeCryptContextHandle()
: base(true) {
}
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
internal SafeCryptContextHandle(IntPtr handle, bool ownsHandle)
: base(ownsHandle) {
SetHandle(handle);
}
override protected bool ReleaseHandle() {
if (handle != IntPtr.Zero) {
UnsafeNativeMethods.CryptReleaseContext(this, 0);
return true;
}
return false;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace Microsoft.Win32 {
using System;
using System.Security.Permissions;
using Microsoft.Win32.SafeHandles;
using System.Configuration;
// Safehandle for crypt context handles
[System.Security.SuppressUnmanagedCodeSecurityAttribute()]
internal sealed class SafeCryptContextHandle : SafeHandleZeroOrMinusOneIsInvalid {
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
internal SafeCryptContextHandle()
: base(true) {
}
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
internal SafeCryptContextHandle(IntPtr handle, bool ownsHandle)
: base(ownsHandle) {
SetHandle(handle);
}
override protected bool ReleaseHandle() {
if (handle != IntPtr.Zero) {
UnsafeNativeMethods.CryptReleaseContext(this, 0);
return true;
}
return false;
}
}
}
// 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
- XhtmlBasicCalendarAdapter.cs
- TdsParserStaticMethods.cs
- SqlDataSourceFilteringEventArgs.cs
- IconHelper.cs
- TableStyle.cs
- TextTreeExtractElementUndoUnit.cs
- SqlTopReducer.cs
- SQLBytes.cs
- SiteMap.cs
- HttpCacheVary.cs
- EmptyEnumerator.cs
- RowType.cs
- UnsafeNativeMethods.cs
- Vars.cs
- SubstitutionList.cs
- SafeSecurityHandles.cs
- RC2CryptoServiceProvider.cs
- SourceLineInfo.cs
- FrameworkTemplate.cs
- ValidationHelper.cs
- Random.cs
- BasicHttpSecurityMode.cs
- TableRow.cs
- CapacityStreamGeometryContext.cs
- ClientSettingsStore.cs
- DecoderFallback.cs
- TargetConverter.cs
- MetadataWorkspace.cs
- PerfService.cs
- TableLayoutStyleCollection.cs
- ComponentCollection.cs
- SharingService.cs
- hresults.cs
- NegotiateStream.cs
- DefaultValueAttribute.cs
- CacheEntry.cs
- DateBoldEvent.cs
- UrlParameterReader.cs
- RunWorkerCompletedEventArgs.cs
- ExpressionVisitor.cs
- SharedRuntimeState.cs
- EventManager.cs
- ComNativeDescriptor.cs
- SByteStorage.cs
- WindowsFormsSynchronizationContext.cs
- HttpConfigurationContext.cs
- KeyBinding.cs
- GeneralTransform.cs
- HttpProcessUtility.cs
- Maps.cs
- DodSequenceMerge.cs
- TrackPoint.cs
- SQLGuid.cs
- Int32EqualityComparer.cs
- XmlSchemaNotation.cs
- EdmSchemaError.cs
- LoginView.cs
- TaskFileService.cs
- LinqExpressionNormalizer.cs
- RegexTree.cs
- OdbcDataAdapter.cs
- LinqExpressionNormalizer.cs
- RbTree.cs
- BitmapScalingModeValidation.cs
- SoundPlayer.cs
- EntityDescriptor.cs
- AccessDataSource.cs
- ContextQuery.cs
- Lease.cs
- EpmCustomContentDeSerializer.cs
- BinaryParser.cs
- XmlSchemaSubstitutionGroup.cs
- ConfigurationFileMap.cs
- MemoryStream.cs
- TextCompositionEventArgs.cs
- WebPartCollection.cs
- DbProviderSpecificTypePropertyAttribute.cs
- TranslateTransform.cs
- KeyGestureConverter.cs
- Point3DAnimationBase.cs
- EventHandlingScope.cs
- ElementHostPropertyMap.cs
- LinkButton.cs
- ManualResetEvent.cs
- TimelineCollection.cs
- DrawingAttributes.cs
- ArrayConverter.cs
- LOSFormatter.cs
- ItemCollection.cs
- TextDecorations.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- DBSqlParserColumn.cs
- IFormattable.cs
- NamespaceList.cs
- TransformValueSerializer.cs
- OrderByExpression.cs
- LongSumAggregationOperator.cs
- RepeaterItem.cs
- Image.cs
- EnterpriseServicesHelper.cs