Move more registry files to shared partition
authorJan Kotas <jkotas@microsoft.com>
Tue, 11 Sep 2018 06:33:05 +0000 (23:33 -0700)
committerJan Kotas <jkotas@microsoft.com>
Tue, 11 Sep 2018 20:00:28 +0000 (13:00 -0700)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/9de98ef09a8998ba8c1f369c0d8067d5ffe1e0e7

src/coreclr/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegFlushKey.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/Microsoft/Win32/RegistryOptions.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/Microsoft/Win32/RegistryValueOptions.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
src/libraries/System.Private.CoreLib/src/System/Security/AccessControl/RegistryRights.cs [new file with mode: 0644]

index 52eeaaed2b5c74d56e2765b5e2ffe512a98e678c..236f4f545b8bf183d4247374f44ec40f613c7291 100644 (file)
@@ -1137,18 +1137,6 @@ namespace Microsoft.Win32
         private const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000;
     }
 
-    [Flags]
-#if REGISTRY_ASSEMBLY
-    public
-#else
-    internal
-#endif
-    enum RegistryValueOptions
-    {
-        None = 0,
-        DoNotExpandEnvironmentNames = 1
-    }
-
     // the name for this API is meant to mimic FileMode, which has similar values
 
     internal enum RegistryKeyPermissionCheck
diff --git a/src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegFlushKey.cs b/src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegFlushKey.cs
new file mode 100644 (file)
index 0000000..8f72798
--- /dev/null
@@ -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 Microsoft.Win32.SafeHandles;
+using System.Runtime.InteropServices;
+
+internal partial class Interop
+{
+    internal partial class Advapi32
+    {
+        [DllImport(Libraries.Advapi32)]
+        internal static extern int RegFlushKey(SafeRegistryHandle hKey);
+    }
+}
diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/RegistryOptions.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/RegistryOptions.cs
new file mode 100644 (file)
index 0000000..201a6df
--- /dev/null
@@ -0,0 +1,20 @@
+// 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;
+
+namespace Microsoft.Win32
+{
+    [Flags]
+#if REGISTRY_ASSEMBLY
+    public
+#else
+    internal
+#endif
+    enum RegistryOptions
+    {
+        None = Interop.Advapi32.RegistryOptions.REG_OPTION_NON_VOLATILE,       // 0x0000
+        Volatile = Interop.Advapi32.RegistryOptions.REG_OPTION_VOLATILE,      // 0x0001
+    };
+}
diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/RegistryValueOptions.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/RegistryValueOptions.cs
new file mode 100644 (file)
index 0000000..7d9b6c4
--- /dev/null
@@ -0,0 +1,20 @@
+// 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;
+
+namespace Microsoft.Win32
+{
+    [Flags]
+#if REGISTRY_ASSEMBLY
+    public
+#else
+    internal
+#endif
+    enum RegistryValueOptions
+    {
+        None = 0,
+        DoNotExpandEnvironmentNames = 1
+    }
+}
index eae7016029c5077e5cb67d5009e1f0c01de22ed9..769b21609810f83e2eb22cf1c311300725ffe20f 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)System\Security\SecureString.Windows.cs" />
   </ItemGroup>
   <ItemGroup Condition="$(TargetsWindows) and '$(EnableWinRT)' != 'true'">
-    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\NtDll\NtQueryInformationFile.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegCreateKeyEx.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegCloseKey.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegCreateKeyEx.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegDeleteKeyEx.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegDeleteValue.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegEnumKeyEx.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegEnumValue.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegFlushKey.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegistryConstants.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegOpenKeyEx.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegQueryInfoKey.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegQueryValueEx.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegSetValueEx.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegistryConstants.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Win32.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)System\TimeZoneInfo.Win32.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\Registry.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\RegistryHive.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\RegistryOptions.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\RegistryValueKind.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\RegistryValueOptions.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\RegistryView.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeRegistryHandle.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeRegistryHandle.Windows.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.LoadLibraryEx.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FreeLibrary.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Security\AccessControl\RegistryRights.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.CreateFile.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FreeLibrary.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.LoadLibraryEx.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.MUI.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.TimeZone.Registry.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\NtDll\NtQueryInformationFile.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\User32\Interop.Constants.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\User32\Interop.SendMessageTimeout.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\User32\Interop.LoadString.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\User32\Interop.SendMessageTimeout.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Win32.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\TimeZoneInfo.Win32.cs" />
   </ItemGroup>
   <ItemGroup Condition="$(TargetsWindows) and '$(EnableWinRT)' == 'true'">
     <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.WinRT.cs" />
diff --git a/src/libraries/System.Private.CoreLib/src/System/Security/AccessControl/RegistryRights.cs b/src/libraries/System.Private.CoreLib/src/System/Security/AccessControl/RegistryRights.cs
new file mode 100644 (file)
index 0000000..729e2f6
--- /dev/null
@@ -0,0 +1,42 @@
+// 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 Microsoft.Win32;
+
+namespace System.Security.AccessControl
+{
+    // We derived this enum from the definitions of KEY_READ and such from
+    // winnt.h and from MSDN, plus some experimental validation with regedit.
+    // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry_key_security_and_access_rights.asp
+    [Flags]
+#if REGISTRY_ASSEMBLY
+    public
+#else
+    internal
+#endif
+    enum RegistryRights
+    {
+        // No None field - An ACE with the value 0 cannot grant nor deny.
+        QueryValues = Interop.Advapi32.RegistryOperations.KEY_QUERY_VALUE,          // 0x0001 query the values of a registry key
+        SetValue = Interop.Advapi32.RegistryOperations.KEY_SET_VALUE,            // 0x0002 create, delete, or set a registry value
+        CreateSubKey = Interop.Advapi32.RegistryOperations.KEY_CREATE_SUB_KEY,       // 0x0004 required to create a subkey of a specific key
+        EnumerateSubKeys = Interop.Advapi32.RegistryOperations.KEY_ENUMERATE_SUB_KEYS,   // 0x0008 required to enumerate sub keys of a key
+        Notify = Interop.Advapi32.RegistryOperations.KEY_NOTIFY,               // 0x0010 needed to request change notifications
+        CreateLink = Interop.Advapi32.RegistryOperations.KEY_CREATE_LINK,          // 0x0020 reserved for system use
+        ///
+        /// The Windows Kernel team agrees that it was a bad design to expose the WOW64_n options as permissions.
+        /// in the .NET Framework these options are exposed via the RegistryView enum
+        ///
+        ///        Reg64             = Interop.Advapi32.RegistryOptions.KEY_WOW64_64KEY,          // 0x0100 operate on the 64-bit registry view
+        ///        Reg32             = Interop.Advapi32.RegistryOptions.KEY_WOW64_32KEY,          // 0x0200 operate on the 32-bit registry view
+        ExecuteKey = ReadKey,
+        ReadKey = Interop.Advapi32.RegistryOperations.STANDARD_RIGHTS_READ | QueryValues | EnumerateSubKeys | Notify,
+        WriteKey = Interop.Advapi32.RegistryOperations.STANDARD_RIGHTS_WRITE | SetValue | CreateSubKey,
+        Delete = 0x10000,
+        ReadPermissions = 0x20000,
+        ChangePermissions = 0x40000,
+        TakeOwnership = 0x80000,
+        FullControl = 0xF003F | Interop.Advapi32.RegistryOperations.STANDARD_RIGHTS_READ | Interop.Advapi32.RegistryOperations.STANDARD_RIGHTS_WRITE
+    }
+}