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
- FamilyCollection.cs
- DateRangeEvent.cs
- ColorPalette.cs
- ScriptResourceAttribute.cs
- RoleGroup.cs
- EditableRegion.cs
- InputLanguageEventArgs.cs
- Transform.cs
- EventManager.cs
- GraphicsContainer.cs
- CachedFontFace.cs
- IDReferencePropertyAttribute.cs
- Brushes.cs
- MSAANativeProvider.cs
- SystemIcmpV6Statistics.cs
- DataSourceHelper.cs
- SimpleWebHandlerParser.cs
- sqlser.cs
- SQLGuidStorage.cs
- SingleAnimationBase.cs
- StateWorkerRequest.cs
- WindowsSolidBrush.cs
- SafeThreadHandle.cs
- ConnectionOrientedTransportBindingElement.cs
- LineServicesRun.cs
- InvalidCastException.cs
- WebPartCollection.cs
- CustomAttribute.cs
- EntityViewGenerationAttribute.cs
- LinqToSqlWrapper.cs
- WindowClosedEventArgs.cs
- CheckBox.cs
- RotateTransform3D.cs
- CompilerParameters.cs
- WsiProfilesElementCollection.cs
- TemplateBindingExpression.cs
- ArrayWithOffset.cs
- MouseGestureConverter.cs
- XPathSelectionIterator.cs
- TraceHandler.cs
- CompilerResults.cs
- EntityDataSourceChangedEventArgs.cs
- XmlSerializerVersionAttribute.cs
- XmlChoiceIdentifierAttribute.cs
- UInt64Converter.cs
- SectionRecord.cs
- ServiceMetadataPublishingElement.cs
- TextSpan.cs
- EntitySetBase.cs
- ContainerUIElement3D.cs
- SerializationFieldInfo.cs
- WebSysDescriptionAttribute.cs
- RichTextBoxAutomationPeer.cs
- InfocardChannelParameter.cs
- HttpModuleAction.cs
- CrossContextChannel.cs
- KeyFrames.cs
- DataPagerFieldItem.cs
- JpegBitmapEncoder.cs
- MethodBuilder.cs
- TextBreakpoint.cs
- RegexGroup.cs
- OrderingQueryOperator.cs
- PingOptions.cs
- JavaScriptObjectDeserializer.cs
- XamlStackWriter.cs
- DataSourceCache.cs
- ErrorRuntimeConfig.cs
- PasswordDeriveBytes.cs
- StoreItemCollection.Loader.cs
- InputBinder.cs
- ExpandCollapseProviderWrapper.cs
- IPEndPointCollection.cs
- CalendarDay.cs
- NameNode.cs
- Update.cs
- PageHandlerFactory.cs
- RSAOAEPKeyExchangeDeformatter.cs
- DllNotFoundException.cs
- DataShape.cs
- ExtensionWindowHeader.cs
- CustomValidator.cs
- AccessibleObject.cs
- ExpressionEditorAttribute.cs
- OutputCache.cs
- ArgumentOutOfRangeException.cs
- WebScriptMetadataMessageEncodingBindingElement.cs
- MediaEntryAttribute.cs
- WmlObjectListAdapter.cs
- MulticastNotSupportedException.cs
- SaveFileDialog.cs
- DirectionalLight.cs
- HtmlTableCell.cs
- Condition.cs
- RepeatBehavior.cs
- TransactionScopeDesigner.cs
- UniqueCodeIdentifierScope.cs
- FillBehavior.cs
- SizeIndependentAnimationStorage.cs
- TypeBrowser.xaml.cs