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
- RowUpdatedEventArgs.cs
- DocumentXmlWriter.cs
- RegisteredHiddenField.cs
- InlinedLocationReference.cs
- OracleDataAdapter.cs
- _SslSessionsCache.cs
- sqlinternaltransaction.cs
- MsmqHostedTransportConfiguration.cs
- TableAdapterManagerMethodGenerator.cs
- TypeGeneratedEventArgs.cs
- IndicFontClient.cs
- TcpChannelHelper.cs
- PowerModeChangedEventArgs.cs
- MaskInputRejectedEventArgs.cs
- MethodResolver.cs
- TypefaceCollection.cs
- SaveFileDialog.cs
- XmlChoiceIdentifierAttribute.cs
- TransportContext.cs
- PropertyTab.cs
- TraceRecords.cs
- FileClassifier.cs
- WorkflowMarkupSerializer.cs
- XmlSchemaException.cs
- shaper.cs
- Int32.cs
- PackagingUtilities.cs
- ToolZone.cs
- CallContext.cs
- BoundingRectTracker.cs
- TdsParserStateObject.cs
- ModelItemDictionary.cs
- TextureBrush.cs
- TextSpan.cs
- KeyValuePair.cs
- ServiceCredentialsSecurityTokenManager.cs
- EventProperty.cs
- NameValueSectionHandler.cs
- XPathSingletonIterator.cs
- DataGridViewTextBoxColumn.cs
- CompiledQueryCacheKey.cs
- PlatformNotSupportedException.cs
- StickyNoteAnnotations.cs
- SqlTypeSystemProvider.cs
- SessionStateUtil.cs
- TypedTableBase.cs
- TextLine.cs
- BaseCollection.cs
- SynchronizedDisposablePool.cs
- StringExpressionSet.cs
- Icon.cs
- DataGridViewCellCancelEventArgs.cs
- TdsParserSafeHandles.cs
- WebPartCloseVerb.cs
- DateTimeValueSerializer.cs
- BindingContext.cs
- SendActivityDesignerTheme.cs
- SizeChangedInfo.cs
- ReferenceConverter.cs
- MsmqEncryptionAlgorithm.cs
- MsdtcWrapper.cs
- SessionEndingEventArgs.cs
- UpdatableWrapper.cs
- XmlSchemaInfo.cs
- DataPagerCommandEventArgs.cs
- messageonlyhwndwrapper.cs
- RemoteDebugger.cs
- WindowsSecurityTokenAuthenticator.cs
- PageContent.cs
- RoutedEvent.cs
- DBBindings.cs
- Rfc2898DeriveBytes.cs
- InstanceCreationEditor.cs
- Logging.cs
- SystemResources.cs
- Pts.cs
- TemplateApplicationHelper.cs
- RichTextBoxConstants.cs
- WebConfigurationHostFileChange.cs
- SourceElementsCollection.cs
- Version.cs
- DrawingContextWalker.cs
- ToolStripItemTextRenderEventArgs.cs
- ParseChildrenAsPropertiesAttribute.cs
- ReflectionServiceProvider.cs
- InputScopeConverter.cs
- ExceptionUtil.cs
- StringValueConverter.cs
- GenerateTemporaryTargetAssembly.cs
- EntityCommandDefinition.cs
- TemplatedWizardStep.cs
- WpfWebRequestHelper.cs
- FormViewDesigner.cs
- HtmlInputPassword.cs
- TextRangeBase.cs
- ArrayElementGridEntry.cs
- IndicFontClient.cs
- PlatformNotSupportedException.cs
- StringUtil.cs
- DropDownButton.cs