Using shared copy of registryvalueKind (dotnet/corefx#31922)
authorAnirudh Agnihotry <anirudhagnihotry098@gmail.com>
Mon, 27 Aug 2018 04:03:12 +0000 (21:03 -0700)
committerJan Kotas <jkotas@microsoft.com>
Mon, 27 Aug 2018 23:03:23 +0000 (16:03 -0700)
* using local copy of registryvaluekind and advapi32

* Moving complete file to shared

* name changed

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs [new file with mode: 0644]
src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.RegistryValues.cs [deleted file]
src/System.Private.CoreLib/shared/Microsoft/Win32/RegistryValueKind.cs
src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems

diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs
new file mode 100644 (file)
index 0000000..bdb8970
--- /dev/null
@@ -0,0 +1,65 @@
+// 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.
+
+internal partial class Interop
+{
+    internal partial class Advapi32
+    {
+        internal static class RegistryOptions
+        {
+            internal const int REG_OPTION_NON_VOLATILE = 0x0000;     // (default) keys are persisted beyond reboot/unload
+            internal const int REG_OPTION_VOLATILE = 0x0001;        // All keys created by the function are volatile
+            internal const int REG_OPTION_CREATE_LINK = 0x0002;     // They key is a symbolic link
+            internal const int REG_OPTION_BACKUP_RESTORE = 0x0004;  // Use SE_BACKUP_NAME process special privileges         
+        }
+
+        internal static class RegistryView
+        {
+            internal const int KEY_WOW64_64KEY = 0x0100;
+            internal const int KEY_WOW64_32KEY = 0x0200;
+        }
+
+        internal static class RegistryOperations
+        {
+            internal const int KEY_QUERY_VALUE = 0x0001;
+            internal const int KEY_SET_VALUE = 0x0002;
+            internal const int KEY_CREATE_SUB_KEY = 0x0004;
+            internal const int KEY_ENUMERATE_SUB_KEYS = 0x0008;
+            internal const int KEY_NOTIFY = 0x0010;
+            internal const int KEY_CREATE_LINK = 0x0020;
+            internal const int KEY_READ = ((STANDARD_RIGHTS_READ |
+                                                               KEY_QUERY_VALUE |
+                                                               KEY_ENUMERATE_SUB_KEYS |
+                                                               KEY_NOTIFY)
+                                                              &
+                                                              (~SYNCHRONIZE));
+
+            internal const int KEY_WRITE = ((STANDARD_RIGHTS_WRITE |
+                                                               KEY_SET_VALUE |
+                                                               KEY_CREATE_SUB_KEY)
+                                                              &
+                                                              (~SYNCHRONIZE));
+
+            internal const int SYNCHRONIZE = 0x00100000;
+            internal const int READ_CONTROL = 0x00020000;
+            internal const int STANDARD_RIGHTS_READ = READ_CONTROL;
+            internal const int STANDARD_RIGHTS_WRITE = READ_CONTROL;
+        }
+
+        internal static class RegistryValues
+        {
+            internal const int REG_NONE = 0;                // No value type
+            internal const int REG_SZ = 1;                  // Unicode nul terminated string
+            internal const int REG_EXPAND_SZ = 2;           // Unicode nul terminated string
+            // (with environment variable references)
+            internal const int REG_BINARY = 3;              // Free form binary
+            internal const int REG_DWORD = 4;               // 32-bit number
+            internal const int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD)
+            internal const int REG_DWORD_BIG_ENDIAN = 5;    // 32-bit number
+            internal const int REG_LINK = 6;                // Symbolic Link (Unicode)
+            internal const int REG_MULTI_SZ = 7;            // Multiple Unicode strings
+            internal const int REG_QWORD = 11;             // 64-bit number
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.RegistryValues.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.RegistryValues.cs
deleted file mode 100644 (file)
index 3c02c49..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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.
-
-internal partial class Interop
-{
-    internal partial class Kernel32
-    {
-        internal partial class RegistryValues
-        {
-            internal const int REG_NONE = 0;                // No value type
-            internal const int REG_SZ = 1;                  // Unicode nul terminated string
-            internal const int REG_EXPAND_SZ = 2;           // Unicode nul terminated string
-            // (with environment variable references)
-            internal const int REG_BINARY = 3;              // Free form binary
-            internal const int REG_DWORD = 4;               // 32-bit number
-            internal const int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD)
-            internal const int REG_DWORD_BIG_ENDIAN = 5;    // 32-bit number
-            internal const int REG_LINK = 6;                // Symbolic Link (Unicode)
-            internal const int REG_MULTI_SZ = 7;            // Multiple Unicode strings
-            internal const int REG_QWORD = 11;             // 64-bit number
-        }
-    }
-}
index 5395abe..bc6efcc 100644 (file)
@@ -11,12 +11,12 @@ namespace Microsoft.Win32
 #endif
     enum RegistryValueKind
     {
-        String = Interop.Kernel32.RegistryValues.REG_SZ,
-        ExpandString = Interop.Kernel32.RegistryValues.REG_EXPAND_SZ,
-        Binary = Interop.Kernel32.RegistryValues.REG_BINARY,
-        DWord = Interop.Kernel32.RegistryValues.REG_DWORD,
-        MultiString = Interop.Kernel32.RegistryValues.REG_MULTI_SZ,
-        QWord = Interop.Kernel32.RegistryValues.REG_QWORD,
+        String = Interop.Advapi32.RegistryValues.REG_SZ,
+        ExpandString = Interop.Advapi32.RegistryValues.REG_EXPAND_SZ,
+        Binary = Interop.Advapi32.RegistryValues.REG_BINARY,
+        DWord = Interop.Advapi32.RegistryValues.REG_DWORD,
+        MultiString = Interop.Advapi32.RegistryValues.REG_MULTI_SZ,
+        QWord = Interop.Advapi32.RegistryValues.REG_QWORD,
         Unknown = 0,                          // REG_NONE is defined as zero but BCL
         None = unchecked((int)0xFFFFFFFF), //  mistakenly overrode this value.  
     }   // Now instead of using Interop.Kernel32.RegistryValues.REG_NONE we use "-1".
index ef48dc6..69765a4 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.OutputDebugString.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_IntPtr.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_NativeOverlapped.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.RegistryValues.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.RegistryView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SECURITY_ATTRIBUTES.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SecurityOptions.cs" />
   </ItemGroup>
   <ItemGroup Condition="$(TargetsWindows) and '$(EnableWinRT)' != 'true'">
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\NtDll\NtQueryInformationFile.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" />