This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves CurrentSystemTimeZone, ICastable, RegistryView and RegistryValu…
…eKind to shared (#18337) * Moves CurrentSystemTimeZone to shared completely * Moves ICastable to shared * Moves RegistryView and RegistryValueKind to shared * Moves ICastableHelpers to its own file
- Loading branch information
1 parent
a513283
commit 56fe643
Showing
14 changed files
with
149 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.RegistryValues.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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_MULTI_SZ = 7; // Multiple Unicode strings | ||
internal const int REG_QWORD = 11; // 64-bit number | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.RegistryView.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Kernel32 | ||
{ | ||
internal partial class RegistryView | ||
{ | ||
internal const int KEY_WOW64_64KEY = 0x0100; | ||
internal const int KEY_WOW64_32KEY = 0x0200; | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/System.Private.CoreLib/shared/Microsoft/Win32/RegistryValueKind.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// 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. | ||
|
||
|
||
namespace Microsoft.Win32 | ||
{ | ||
#if REGISTRY_ASSEMBLY | ||
public | ||
#else | ||
internal | ||
#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, | ||
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". | ||
} |
20 changes: 20 additions & 0 deletions
20
src/System.Private.CoreLib/shared/Microsoft/Win32/RegistryView.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
{ | ||
#if REGISTRY_ASSEMBLY | ||
public | ||
#else | ||
internal | ||
#endif | ||
enum RegistryView | ||
{ | ||
Default = 0, // 0x0000 operate on the default registry view | ||
Registry64 = Interop.Kernel32.RegistryView.KEY_WOW64_64KEY, // 0x0100 operate on the 64-bit registry view | ||
Registry32 = Interop.Kernel32.RegistryView.KEY_WOW64_32KEY, // 0x0200 operate on the 32-bit registry view | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
src/System.Private.CoreLib/src/Microsoft/Win32/RegistryValueKind.cs
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
src/System.Private.CoreLib/src/Microsoft/Win32/RegistryView.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
src/System.Private.CoreLib/src/System/CurrentSystemTimeZone.Cache.cs
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ICastableHelpers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// 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 System.Runtime.CompilerServices | ||
{ | ||
|
||
/// <summary> | ||
/// Helpers that allows VM to call into ICastable methods without having to deal with RuntimeTypeHandle. | ||
/// RuntimeTypeHandle is a struct and is always passed in stack in x86, which our VM call helpers don't | ||
/// particularly like. | ||
/// </summary> | ||
internal class ICastableHelpers | ||
{ | ||
internal static bool IsInstanceOfInterface(ICastable castable, RuntimeType type, out Exception castError) | ||
{ | ||
return castable.IsInstanceOfInterface(new RuntimeTypeHandle(type), out castError); | ||
} | ||
|
||
internal static RuntimeType GetImplType(ICastable castable, RuntimeType interfaceType) | ||
{ | ||
return castable.GetImplType(new RuntimeTypeHandle(interfaceType)).GetRuntimeType(); | ||
} | ||
} | ||
} |