Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Tools / WSATConfig / Configuration / SafeRegistryKey.cs / 1 / SafeRegistryKey.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace Microsoft.Tools.ServiceModel.WsatConfig
{
using System;
using System.Security;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using Microsoft.Win32.SafeHandles;
sealed class SafeRegistryKey : SafeHandleZeroOrMinusOneIsInvalid
{
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
internal SafeRegistryKey() : base(false) { }
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
internal SafeRegistryKey(IntPtr preexistingHandle, bool ownsHandle)
: base(ownsHandle)
{
SetHandle(preexistingHandle);
}
protected override bool ReleaseHandle()
{
// Returns a Win32 error code, 0 for success
int r = SafeNativeMethods.RegCloseKey(handle);
return r == 0;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HttpClientCredentialType.cs
- TrackingConditionCollection.cs
- SmtpReplyReader.cs
- EventRecord.cs
- FrameworkContextData.cs
- DefaultAuthorizationContext.cs
- DeflateStream.cs
- XamlStyleSerializer.cs
- FormsIdentity.cs
- SHA512Managed.cs
- URLMembershipCondition.cs
- TypeTypeConverter.cs
- HtmlEmptyTagControlBuilder.cs
- DataSourceCache.cs
- UriTemplateLiteralPathSegment.cs
- SubMenuStyleCollection.cs
- FrameworkContentElement.cs
- DataServiceConfiguration.cs
- TextViewElement.cs
- XPathCompiler.cs
- MsmqIntegrationProcessProtocolHandler.cs
- ResourceDisplayNameAttribute.cs
- ToolStripLabel.cs
- PrintPreviewControl.cs
- HostedNamedPipeTransportManager.cs
- QuotedStringFormatReader.cs
- Rule.cs
- ViewSimplifier.cs
- DataControlFieldCell.cs
- LinkUtilities.cs
- TableAdapterManagerMethodGenerator.cs
- DataGridClipboardCellContent.cs
- ConfigXmlElement.cs
- Classification.cs
- DesignerTransactionCloseEvent.cs
- IMembershipProvider.cs
- CodeAttributeDeclaration.cs
- AccessibleObject.cs
- FormsAuthenticationEventArgs.cs
- AuthenticationService.cs
- DBCommand.cs
- GZipDecoder.cs
- ToolStripDropDownButton.cs
- PolicyStatement.cs
- Point.cs
- PointLight.cs
- ReadWriteObjectLock.cs
- DataObjectMethodAttribute.cs
- ObsoleteAttribute.cs
- DesignerActionGlyph.cs
- UnsafeNativeMethods.cs
- GeometryModel3D.cs
- TextTreeInsertElementUndoUnit.cs
- ObjectCacheHost.cs
- EmptyQuery.cs
- PriorityBinding.cs
- AddInControllerImpl.cs
- MembershipValidatePasswordEventArgs.cs
- VBIdentifierTrimConverter.cs
- SmiMetaDataProperty.cs
- ModelVisual3D.cs
- XamlPointCollectionSerializer.cs
- HtmlTextViewAdapter.cs
- SkewTransform.cs
- RemoteWebConfigurationHostStream.cs
- ActivityExecutionWorkItem.cs
- HttpHandler.cs
- IsolationInterop.cs
- RSACryptoServiceProvider.cs
- XsltQilFactory.cs
- SecurityContext.cs
- OLEDB_Enum.cs
- AdjustableArrowCap.cs
- MaskedTextBoxTextEditor.cs
- XPathExpr.cs
- DataGridViewControlCollection.cs
- SoapClientMessage.cs
- OrderablePartitioner.cs
- XmlDataLoader.cs
- XmlSchemaExternal.cs
- SqlFlattener.cs
- IgnoreSectionHandler.cs
- XmlStreamStore.cs
- Registration.cs
- X509SecurityTokenProvider.cs
- ToolStripCodeDomSerializer.cs
- HttpCapabilitiesSectionHandler.cs
- IDReferencePropertyAttribute.cs
- ImageListStreamer.cs
- dsa.cs
- FileAuthorizationModule.cs
- OleDbEnumerator.cs
- SafeFileMappingHandle.cs
- XamlToRtfParser.cs
- ControlDesigner.cs
- CreateUserErrorEventArgs.cs
- ConvertersCollection.cs
- HostingEnvironmentSection.cs
- UInt32Storage.cs
- Stylesheet.cs