Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / Microsoft / Win32 / SafeCryptContextHandle.cs / 1305376 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ObjectCloneHelper.cs
- UInt64Converter.cs
- BlockCollection.cs
- SmtpCommands.cs
- X509CertificateCollection.cs
- NTAccount.cs
- GridViewUpdatedEventArgs.cs
- Parser.cs
- BStrWrapper.cs
- EntityKey.cs
- SqlDependency.cs
- EncoderExceptionFallback.cs
- FileDialogCustomPlace.cs
- PictureBox.cs
- GlobalProxySelection.cs
- ResourceContainer.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- SerializationInfo.cs
- WebPartCloseVerb.cs
- ComplexBindingPropertiesAttribute.cs
- XmlSchemaException.cs
- WebBrowserBase.cs
- controlskin.cs
- ConnectionStringsExpressionBuilder.cs
- Vector3DConverter.cs
- ToolStripDesignerAvailabilityAttribute.cs
- ResourceProperty.cs
- SrgsSubset.cs
- CodeGeneratorOptions.cs
- SerialPort.cs
- TrustSection.cs
- ActivationServices.cs
- webeventbuffer.cs
- Dump.cs
- RuntimeResourceSet.cs
- CustomValidator.cs
- Marshal.cs
- HttpServerVarsCollection.cs
- FormatConvertedBitmap.cs
- CallbackValidatorAttribute.cs
- CallbackHandler.cs
- CategoriesDocument.cs
- GeneralTransform3DCollection.cs
- DrawItemEvent.cs
- InfoCardTrace.cs
- RawMouseInputReport.cs
- DataGridViewRowConverter.cs
- ConfigurationValues.cs
- WindowsFormsHost.cs
- TraceHwndHost.cs
- UserNameSecurityTokenParameters.cs
- GeometryDrawing.cs
- SqlGatherConsumedAliases.cs
- ContravarianceAdapter.cs
- DesignerCategoryAttribute.cs
- _AutoWebProxyScriptWrapper.cs
- TraceContext.cs
- EmbeddedObject.cs
- SHA384Managed.cs
- PointCollectionValueSerializer.cs
- VolatileEnlistmentState.cs
- AdPostCacheSubstitution.cs
- GridViewRowEventArgs.cs
- DataSpaceManager.cs
- MonikerHelper.cs
- User.cs
- _FtpControlStream.cs
- AuthenticationModulesSection.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- SamlSubjectStatement.cs
- RuleInfoComparer.cs
- SerializationSectionGroup.cs
- UnmanagedMemoryStream.cs
- RtfControlWordInfo.cs
- AffineTransform3D.cs
- XmlElement.cs
- MiniParameterInfo.cs
- TransactionProtocolConverter.cs
- SyndicationDeserializer.cs
- RelationshipWrapper.cs
- XmlExpressionDumper.cs
- BinaryConverter.cs
- ASCIIEncoding.cs
- FloaterBaseParagraph.cs
- SafePointer.cs
- RSAProtectedConfigurationProvider.cs
- TypeInfo.cs
- CommandBindingCollection.cs
- PlatformCulture.cs
- TableLayoutColumnStyleCollection.cs
- Documentation.cs
- BinaryReader.cs
- HierarchicalDataBoundControlAdapter.cs
- ResourceDefaultValueAttribute.cs
- SeverityFilter.cs
- CommandBinding.cs
- LedgerEntry.cs
- NamespaceQuery.cs
- updateconfighost.cs
- CodeTypeReference.cs