Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Tools / WSATConfig / Configuration / SafeRegistryKey.cs / 1305376 / 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. //----------------------------------------------------------------------------- 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CroppedBitmap.cs
- DocumentGridPage.cs
- RegexCharClass.cs
- FactoryMaker.cs
- EditorPartCollection.cs
- SurrogateDataContract.cs
- CreateBookmarkScope.cs
- FragmentNavigationEventArgs.cs
- ParagraphVisual.cs
- RootBrowserWindowProxy.cs
- SqlBuilder.cs
- X509SubjectKeyIdentifierClause.cs
- VirtualDirectoryMappingCollection.cs
- WebProxyScriptElement.cs
- MachineKeySection.cs
- TypeSystemHelpers.cs
- WebPartCollection.cs
- PropertyValueChangedEvent.cs
- DataViewManager.cs
- DateTimeFormatInfo.cs
- Crc32.cs
- Assembly.cs
- UriTemplateClientFormatter.cs
- Collection.cs
- HealthMonitoringSectionHelper.cs
- AdapterUtil.cs
- NativeWrapper.cs
- HttpHostedTransportConfiguration.cs
- WindowsTitleBar.cs
- WorkflowEventArgs.cs
- ItemsChangedEventArgs.cs
- MappingSource.cs
- ConfigXmlWhitespace.cs
- Helper.cs
- XmlIgnoreAttribute.cs
- ChangeConflicts.cs
- WindowsAltTab.cs
- PropertyGeneratedEventArgs.cs
- WebPartTransformerAttribute.cs
- DataGridViewCellConverter.cs
- URL.cs
- MarkupCompiler.cs
- Dynamic.cs
- DataGridDesigner.cs
- NonSerializedAttribute.cs
- GlyphCache.cs
- ClientSettingsProvider.cs
- EntityObject.cs
- FileChangeNotifier.cs
- DriveInfo.cs
- ZipIOExtraFieldZip64Element.cs
- EntityChangedParams.cs
- InstanceCompleteException.cs
- RotationValidation.cs
- SortQuery.cs
- JournalNavigationScope.cs
- ResourcePart.cs
- DetailsViewPagerRow.cs
- BulletDecorator.cs
- Assert.cs
- DesignerRegion.cs
- ModifierKeysValueSerializer.cs
- ResourceExpression.cs
- SimpleMailWebEventProvider.cs
- IdnMapping.cs
- GeneralTransform.cs
- ProfileManager.cs
- XamlInterfaces.cs
- PageSettings.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- ListCollectionView.cs
- WeakEventTable.cs
- SqlNotificationEventArgs.cs
- ProfileGroupSettings.cs
- HttpModuleCollection.cs
- EnvelopedPkcs7.cs
- ToolTipAutomationPeer.cs
- UdpTransportSettings.cs
- NonParentingControl.cs
- Content.cs
- TextServicesDisplayAttributePropertyRanges.cs
- PenLineJoinValidation.cs
- BrushValueSerializer.cs
- DynamicRenderer.cs
- _FtpDataStream.cs
- ControlParameter.cs
- ByteBufferPool.cs
- MetadataPropertyCollection.cs
- DocComment.cs
- BooleanConverter.cs
- ContextBase.cs
- RedirectionProxy.cs
- QilName.cs
- CodeTypeConstructor.cs
- SelectorAutomationPeer.cs
- SqlReferenceCollection.cs
- ExpressionEditorAttribute.cs
- DesignConnection.cs
- XmlUTF8TextReader.cs
- AddingNewEventArgs.cs