Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 9272df6

Browse files
Anipikjkotas
authored andcommitted
Using shared copy of registryvalueKind (dotnet/corefx#31922)
* using local copy of registryvaluekind and advapi32 * Moving complete file to shared * name changed Signed-off-by: dotnet-bot <[email protected]>
1 parent 41f67db commit 9272df6

File tree

4 files changed

+72
-31
lines changed

4 files changed

+72
-31
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
internal partial class Interop
6+
{
7+
internal partial class Advapi32
8+
{
9+
internal static class RegistryOptions
10+
{
11+
internal const int REG_OPTION_NON_VOLATILE = 0x0000; // (default) keys are persisted beyond reboot/unload
12+
internal const int REG_OPTION_VOLATILE = 0x0001; // All keys created by the function are volatile
13+
internal const int REG_OPTION_CREATE_LINK = 0x0002; // They key is a symbolic link
14+
internal const int REG_OPTION_BACKUP_RESTORE = 0x0004; // Use SE_BACKUP_NAME process special privileges
15+
}
16+
17+
internal static class RegistryView
18+
{
19+
internal const int KEY_WOW64_64KEY = 0x0100;
20+
internal const int KEY_WOW64_32KEY = 0x0200;
21+
}
22+
23+
internal static class RegistryOperations
24+
{
25+
internal const int KEY_QUERY_VALUE = 0x0001;
26+
internal const int KEY_SET_VALUE = 0x0002;
27+
internal const int KEY_CREATE_SUB_KEY = 0x0004;
28+
internal const int KEY_ENUMERATE_SUB_KEYS = 0x0008;
29+
internal const int KEY_NOTIFY = 0x0010;
30+
internal const int KEY_CREATE_LINK = 0x0020;
31+
internal const int KEY_READ = ((STANDARD_RIGHTS_READ |
32+
KEY_QUERY_VALUE |
33+
KEY_ENUMERATE_SUB_KEYS |
34+
KEY_NOTIFY)
35+
&
36+
(~SYNCHRONIZE));
37+
38+
internal const int KEY_WRITE = ((STANDARD_RIGHTS_WRITE |
39+
KEY_SET_VALUE |
40+
KEY_CREATE_SUB_KEY)
41+
&
42+
(~SYNCHRONIZE));
43+
44+
internal const int SYNCHRONIZE = 0x00100000;
45+
internal const int READ_CONTROL = 0x00020000;
46+
internal const int STANDARD_RIGHTS_READ = READ_CONTROL;
47+
internal const int STANDARD_RIGHTS_WRITE = READ_CONTROL;
48+
}
49+
50+
internal static class RegistryValues
51+
{
52+
internal const int REG_NONE = 0; // No value type
53+
internal const int REG_SZ = 1; // Unicode nul terminated string
54+
internal const int REG_EXPAND_SZ = 2; // Unicode nul terminated string
55+
// (with environment variable references)
56+
internal const int REG_BINARY = 3; // Free form binary
57+
internal const int REG_DWORD = 4; // 32-bit number
58+
internal const int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD)
59+
internal const int REG_DWORD_BIG_ENDIAN = 5; // 32-bit number
60+
internal const int REG_LINK = 6; // Symbolic Link (Unicode)
61+
internal const int REG_MULTI_SZ = 7; // Multiple Unicode strings
62+
internal const int REG_QWORD = 11; // 64-bit number
63+
}
64+
}
65+
}

src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.RegistryValues.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/System.Private.CoreLib/shared/Microsoft/Win32/RegistryValueKind.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ namespace Microsoft.Win32
1111
#endif
1212
enum RegistryValueKind
1313
{
14-
String = Interop.Kernel32.RegistryValues.REG_SZ,
15-
ExpandString = Interop.Kernel32.RegistryValues.REG_EXPAND_SZ,
16-
Binary = Interop.Kernel32.RegistryValues.REG_BINARY,
17-
DWord = Interop.Kernel32.RegistryValues.REG_DWORD,
18-
MultiString = Interop.Kernel32.RegistryValues.REG_MULTI_SZ,
19-
QWord = Interop.Kernel32.RegistryValues.REG_QWORD,
14+
String = Interop.Advapi32.RegistryValues.REG_SZ,
15+
ExpandString = Interop.Advapi32.RegistryValues.REG_EXPAND_SZ,
16+
Binary = Interop.Advapi32.RegistryValues.REG_BINARY,
17+
DWord = Interop.Advapi32.RegistryValues.REG_DWORD,
18+
MultiString = Interop.Advapi32.RegistryValues.REG_MULTI_SZ,
19+
QWord = Interop.Advapi32.RegistryValues.REG_QWORD,
2020
Unknown = 0, // REG_NONE is defined as zero but BCL
2121
None = unchecked((int)0xFFFFFFFF), // mistakenly overrode this value.
2222
} // Now instead of using Interop.Kernel32.RegistryValues.REG_NONE we use "-1".

src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,6 @@
761761
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.OutputDebugString.cs" />
762762
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_IntPtr.cs" />
763763
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_NativeOverlapped.cs" />
764-
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.RegistryValues.cs" />
765764
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.RegistryView.cs" />
766765
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SECURITY_ATTRIBUTES.cs" />
767766
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SecurityOptions.cs" />
@@ -806,6 +805,7 @@
806805
</ItemGroup>
807806
<ItemGroup Condition="$(TargetsWindows) and '$(EnableWinRT)' != 'true'">
808807
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\NtDll\NtQueryInformationFile.cs" />
808+
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegistryConstants.cs" />
809809
<Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Win32.cs" />
810810
<Compile Include="$(MSBuildThisFileDirectory)System\TimeZoneInfo.Win32.cs" />
811811
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\Registry.cs" />

0 commit comments

Comments
 (0)