non shared changes and feedback addressed
authorAnipik <anirudhagnihotry098@gmail.com>
Sun, 12 Aug 2018 22:42:34 +0000 (15:42 -0700)
committerJan Kotas <jkotas@microsoft.com>
Mon, 13 Aug 2018 04:43:48 +0000 (21:43 -0700)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/35dafea02d196d5acb998c8a4fff3e6a37365db8

src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.Windows.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems

diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.Windows.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.Windows.cs
new file mode 100644 (file)
index 0000000..9b66804
--- /dev/null
@@ -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;
+    }
+}
index a3132aeed308e8273444a947c2aa0ae40a789265..ae35b03d54f0cb718fc5f77fcc9d755df5de8a5e 100644 (file)
@@ -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);
-        }
     }
 }
index e002a3577301fab3c0d550fba44ef859629033b0..b78eebcd6f174f7a0904fbb0476d840e9247aaf9 100644 (file)
     <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" />