diff options
author | Anirudh Agnihotry <anirudhagnihotry098@gmail.com> | 2018-08-11 00:31:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-11 00:31:01 -0700 |
commit | f551543427176850c84b9e11c7b8d528c3f282a7 (patch) | |
tree | 02b362850f81f902dbebd8f45817c0830526fa1b | |
parent | b2c4c8c4713a029b8c59f481c967dec3c98f005a (diff) | |
download | coreclr-f551543427176850c84b9e11c7b8d528c3f282a7.tar.gz coreclr-f551543427176850c84b9e11c7b8d528c3f282a7.tar.bz2 coreclr-f551543427176850c84b9e11c7b8d528c3f282a7.zip |
moved to shared (#19419)
-rw-r--r-- | src/System.Private.CoreLib/System.Private.CoreLib.csproj | 3 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCloseKey.cs | 15 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/Interop/Windows/Interop.Libraries.cs | 1 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs (renamed from src/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs) | 22 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems | 2 | ||||
-rw-r--r-- | src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.cs | 2 |
6 files changed, 27 insertions, 18 deletions
diff --git a/src/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/System.Private.CoreLib.csproj index 73819e1e4f..70c5749105 100644 --- a/src/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -482,9 +482,6 @@ <Compile Include="$(BclSourcesRoot)\System\Collections\ObjectModel\ReadOnlyDictionary.cs" /> </ItemGroup> <ItemGroup> - <Compile Condition="'$(FeatureWin32Registry)' == 'true'" Include="$(BclSourcesRoot)\Microsoft\Win32\SafeHandles\SafeRegistryHandle.cs" /> - </ItemGroup> - <ItemGroup> <Compile Include="$(BclSourcesRoot)\System\Numerics\Hashing\HashHelpers.cs" /> </ItemGroup> <ItemGroup Condition="'$(TargetsUnix)' == 'true'"> diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCloseKey.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCloseKey.cs new file mode 100644 index 0000000000..375376d52a --- /dev/null +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCloseKey.cs @@ -0,0 +1,15 @@ +// 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; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [DllImport(Libraries.Advapi32)] + internal static extern int RegCloseKey(IntPtr hKey); + } +} diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Interop.Libraries.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Interop.Libraries.cs index 45d910bfcc..7b77d2dad3 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Interop.Libraries.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Interop.Libraries.cs @@ -6,6 +6,7 @@ internal static partial class Interop { internal static partial class Libraries { + internal const string Advapi32 = "advapi32.dll"; internal const string BCrypt = "BCrypt.dll"; internal const string Crypt32 = "crypt32.dll"; internal const string Kernel32 = "kernel32.dll"; diff --git a/src/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs b/src/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs index b69bc42e64..a3132aeed3 100644 --- a/src/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs +++ b/src/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs @@ -2,13 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -// -// -// -// Implements Microsoft.Win32.SafeHandles.SafeRegistryHandle -// -// ====================================================================================== - using System; using System.Security; using System.Runtime.InteropServices; @@ -18,7 +11,12 @@ using System.Runtime.Versioning; namespace Microsoft.Win32.SafeHandles { - internal sealed class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid +#if REGISTRY_ASSEMBLY + public +#else + internal +#endif + sealed class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid { internal SafeRegistryHandle() : base(true) { } @@ -27,13 +25,9 @@ namespace Microsoft.Win32.SafeHandles SetHandle(preexistingHandle); } - override protected bool ReleaseHandle() + protected override bool ReleaseHandle() { - return (RegCloseKey(handle) == Interop.Errors.ERROR_SUCCESS); + return (Interop.Advapi32.RegCloseKey(handle) == Interop.Errors.ERROR_SUCCESS); } - - [DllImport(Win32Native.ADVAPI32)] - internal static extern int RegCloseKey(IntPtr hKey); } } - 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 1133ce5954..e002a35773 100644 --- a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems @@ -808,10 +808,12 @@ <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)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" /> diff --git a/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.cs b/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.cs index 28f86f35dd..69ac1cd039 100644 --- a/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.cs +++ b/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.cs @@ -248,7 +248,7 @@ namespace Microsoft.Win32 // the dispose below and usage elsewhere (other threads). This is By Design. // This is less of an issue when OS > NT5 (i.e Vista & higher), we can close the perfkey // (to release & refresh PERFLIB resources) and the OS will rebuild PERFLIB as necessary. - SafeRegistryHandle.RegCloseKey(RegistryKey.HKEY_PERFORMANCE_DATA); + Interop.Advapi32.RegCloseKey(RegistryKey.HKEY_PERFORMANCE_DATA); } } } |