MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4//5// NOTE: A vast majority of this code was copied from BCL in6// ndp\clr\src\BCL\Microsoft\Win32\Registry.cs.7// Namespace: Microsoft.Win328//9 10using BCLDebug = System.Diagnostics.Debug;11 12namespace Microsoft.PowerShell.Commands.Internal13{14 using System.Runtime.InteropServices;15 using System.Runtime.Versioning;16 using System.Diagnostics.CodeAnalysis;17 18 /**19 * Registry encapsulation. Contains members representing all top level system20 * keys.21 *22 * @security(checkClassLinking=on)23 */24 // This class contains only static members and does not need to be serializable.25 [ComVisible(true)]26 // Suppressed because these objects need to be accessed from CmdLets.27 [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]28 internal static class TransactedRegistry29 {30 private const string resBaseName = "RegistryProviderStrings";31 /**32 * Current User Key.33 *34 * This key should be used as the root for all user specific settings.35 */36 /// <summary>TransactedRegistry.CurrentUser37 /// <para>This static method returns a TransactedRegistryKey object that represents the base38 /// key HKEY_CURRENT_USER. Because it is a base key, there is no transaction associated with39 /// the returned TransactedRegistryKey. This means that values modified using the returned40 /// TransactedRegistryKey are NOT modified within a transaction.</para>41 /// <para>However, if the returned TransactedRegistryKey is used to create, open, or delete42 /// subkeys, there must be a Transaction.Current and the resulting TransactedRegistryKey from those operations ARE associated with43 /// the transaction.</para>44 /// </summary>45 // The TransactedRegistryKey's members cannot be changed.46 [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]47 internal static readonly TransactedRegistryKey CurrentUser = TransactedRegistryKey.GetBaseKey(BaseRegistryKeys.HKEY_CURRENT_USER);48 49 /**50 * Local Machine Key.51 *52 * This key should be used as the root for all machine specific settings.53 */54 /// <summary>TransactedRegistry.LocalMachine55 /// <para>This static method returns a TransactedRegistryKey object that represents the base56 /// key HKEY_LOCAL_MACHINE. Because it is a base key, there is no transaction associated with57 /// the returned TransactedRegistryKey. This means that values modified using the returned58 /// TransactedRegistryKey are NOT modified within a transaction.</para>59 /// <para>However, if the returned TransactedRegistryKey is used to create, open, or delete60 /// subkeys, there must be a Transaction.Current and the resulting TransactedRegistryKey from those operations ARE associated with61 /// the transaction.</para>62 /// </summary>63 // The TransactedRegistryKey's members cannot be changed.64 [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]65 internal static readonly TransactedRegistryKey LocalMachine = TransactedRegistryKey.GetBaseKey(BaseRegistryKeys.HKEY_LOCAL_MACHINE);66 67 /**68 * Classes Root Key.69 *70 * This is the root key of class information.71 */72 /// <summary>TransactedRegistry.ClassesRoot73 /// <para>This static method returns a TransactedRegistryKey object that represents the base74 /// key HKEY_CLASSES_ROOT. Because it is a base key, there is no transaction associated with75 /// the returned TransactedRegistryKey. This means that values modified using the returned76 /// TransactedRegistryKey are NOT modified within a transaction.</para>77 /// <para>However, if the returned TransactedRegistryKey is used to create, open, or delete78 /// subkeys, there must be a Transaction.Current and the resulting TransactedRegistryKey from those operations ARE associated with79 /// the transaction.</para>80 /// </summary>81 // The TransactedRegistryKey's members cannot be changed.82 [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]83 internal static readonly TransactedRegistryKey ClassesRoot = TransactedRegistryKey.GetBaseKey(BaseRegistryKeys.HKEY_CLASSES_ROOT);84 85 /**86 * Users Root Key.87 *88 * This is the root of users.89 */90 /// <summary>TransactedRegistry.Users91 /// <para>This static method returns a TransactedRegistryKey object that represents the base92 /// key HKEY_USERS. Because it is a base key, there is no transaction associated with93 /// the returned TransactedRegistryKey. This means that values modified using the returned94 /// TransactedRegistryKey are NOT modified within a transaction.</para>95 /// <para>However, if the returned TransactedRegistryKey is used to create, open, or delete96 /// subkeys, there must be a Transaction.Current and the resulting TransactedRegistryKey from those operations ARE associated with97 /// the transaction.</para>98 /// </summary>99 // The TransactedRegistryKey's members cannot be changed.100 [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]101 internal static readonly TransactedRegistryKey Users = TransactedRegistryKey.GetBaseKey(BaseRegistryKeys.HKEY_USERS);102 103 /**104 * Current Config Root Key.105 *106 * This is where current configuration information is stored.107 */108 /// <summary>TransactedRegistry.CurrentConfig109 /// <para>This static method returns a TransactedRegistryKey object that represents the base110 /// key HKEY_CURRENT_CONFIG. Because it is a base key, there is no transaction associated with111 /// the returned TransactedRegistryKey. This means that values modified using the returned112 /// TransactedRegistryKey are NOT modified within a transaction.</para>113 /// <para>However, if the returned TransactedRegistryKey is used to create, open, or delete114 /// subkeys, there must be a Transaction.Current and the resulting TransactedRegistryKey from those operations ARE associated with115 /// the transaction.</para>116 /// </summary>117 // The TransactedRegistryKey's members cannot be changed.118 [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]119 internal static readonly TransactedRegistryKey CurrentConfig = TransactedRegistryKey.GetBaseKey(BaseRegistryKeys.HKEY_CURRENT_CONFIG);120 }121}122 