From 5e87259802b774653f5d06be5c4165bf92f23f60 Mon Sep 17 00:00:00 2001 From: Anirudh Agnihotry Date: Sun, 26 Aug 2018 21:03:12 -0700 Subject: [PATCH] Using shared copy of registryvalueKind (dotnet/corefxdotnet/coreclr#31922) * using local copy of registryvaluekind and advapi32 * Moving complete file to shared * name changed Signed-off-by: dotnet-bot Commit migrated from https://github.com/dotnet/coreclr/commit/9272df6f658e6d2badbccd8abdbd75201de64863 --- .../Windows/Advapi32/Interop.RegistryConstants.cs | 65 ++++++++++++++++++++++ .../Windows/Kernel32/Interop.RegistryValues.cs | 24 -------- .../src/Microsoft/Win32/RegistryValueKind.cs | 12 ++-- .../src/System.Private.CoreLib.Shared.projitems | 2 +- 4 files changed, 72 insertions(+), 31 deletions(-) create mode 100644 src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegistryConstants.cs delete mode 100644 src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.RegistryValues.cs diff --git a/src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegistryConstants.cs b/src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegistryConstants.cs new file mode 100644 index 0000000..bdb8970 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegistryConstants.cs @@ -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/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.RegistryValues.cs b/src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.RegistryValues.cs deleted file mode 100644 index 3c02c49..0000000 --- a/src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.RegistryValues.cs +++ /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 - } - } -} diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/RegistryValueKind.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/RegistryValueKind.cs index 5395abe..bc6efcc 100644 --- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/RegistryValueKind.cs +++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/RegistryValueKind.cs @@ -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". diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index ef48dc6..69765a4 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -761,7 +761,6 @@ - @@ -806,6 +805,7 @@ + -- 2.7.4