diff options
author | Anipik <anirudhagnihotry098@gmail.com> | 2018-08-12 15:42:34 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-08-12 21:43:48 -0700 |
commit | 35dafea02d196d5acb998c8a4fff3e6a37365db8 (patch) | |
tree | 215aa079e47a59b71202763aa62f8e56b4df5646 /src | |
parent | 3a56afe6de4113c83b66a5d3a467b8accfaafa1f (diff) | |
download | coreclr-35dafea02d196d5acb998c8a4fff3e6a37365db8.tar.gz coreclr-35dafea02d196d5acb998c8a4fff3e6a37365db8.tar.bz2 coreclr-35dafea02d196d5acb998c8a4fff3e6a37365db8.zip |
non shared changes and feedback addressed
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Diffstat (limited to 'src')
3 files changed, 23 insertions, 13 deletions
diff --git a/src/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeRegistryHandle.Windows.cs b/src/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeRegistryHandle.Windows.cs new file mode 100644 index 0000000000..9b668047a9 --- /dev/null +++ b/src/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeRegistryHandle.Windows.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace Microsoft.Win32.SafeHandles +{ +#if REGISTRY_ASSEMBLY + public +#else + internal +#endif + sealed partial class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid + { + protected override bool ReleaseHandle() => + Interop.Advapi32.RegCloseKey(handle) == Interop.Errors.ERROR_SUCCESS; + } +} diff --git a/src/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs b/src/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs index a3132aeed3..ae35b03d54 100644 --- a/src/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs +++ b/src/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs @@ -3,11 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Security; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; -using System.Runtime.ConstrainedExecution; -using System.Runtime.Versioning; namespace Microsoft.Win32.SafeHandles { @@ -16,7 +11,7 @@ namespace Microsoft.Win32.SafeHandles #else internal #endif - sealed class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid + sealed partial class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid { internal SafeRegistryHandle() : base(true) { } @@ -24,10 +19,5 @@ namespace Microsoft.Win32.SafeHandles { SetHandle(preexistingHandle); } - - protected override bool ReleaseHandle() - { - return (Interop.Advapi32.RegCloseKey(handle) == Interop.Errors.ERROR_SUCCESS); - } } } diff --git a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems index e002a35773..b78eebcd6f 100644 --- a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems @@ -808,12 +808,13 @@ <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Win32.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\TimeZoneInfo.Win32.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)\Microsoft\Win32\SafeHandles\SafeRegistryHandle.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeRegistryHandle.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeRegistryHandle.Windows.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegCloseKey.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.LoadLibraryEx.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FreeLibrary.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.CreateFile.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.MUI.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegCloseKey.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.TimeZone.Registry.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\User32\Interop.Constants.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\User32\Interop.SendMessageTimeout.cs" /> |