Remove redundant System.Runtime.Versioning attributes (#25926)

This commit is contained in:
xtqqczze
2025-08-28 05:54:18 +00:00
committed by GitHub
parent 44e34f0044
commit cf2d7021ab
3 changed files with 0 additions and 41 deletions
@@ -42,7 +42,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// subkeys, there must be a Transaction.Current and the resulting TransactedRegistryKey from those operations ARE associated with
/// the transaction.</para>
/// </summary>
[ResourceExposure(ResourceScope.Machine)]
// The TransactedRegistryKey's members cannot be changed.
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
internal static readonly TransactedRegistryKey CurrentUser = TransactedRegistryKey.GetBaseKey(BaseRegistryKeys.HKEY_CURRENT_USER);
@@ -61,7 +60,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// subkeys, there must be a Transaction.Current and the resulting TransactedRegistryKey from those operations ARE associated with
/// the transaction.</para>
/// </summary>
[ResourceExposure(ResourceScope.Machine)]
// The TransactedRegistryKey's members cannot be changed.
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
internal static readonly TransactedRegistryKey LocalMachine = TransactedRegistryKey.GetBaseKey(BaseRegistryKeys.HKEY_LOCAL_MACHINE);
@@ -80,7 +78,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// subkeys, there must be a Transaction.Current and the resulting TransactedRegistryKey from those operations ARE associated with
/// the transaction.</para>
/// </summary>
[ResourceExposure(ResourceScope.Machine)]
// The TransactedRegistryKey's members cannot be changed.
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
internal static readonly TransactedRegistryKey ClassesRoot = TransactedRegistryKey.GetBaseKey(BaseRegistryKeys.HKEY_CLASSES_ROOT);
@@ -99,7 +96,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// subkeys, there must be a Transaction.Current and the resulting TransactedRegistryKey from those operations ARE associated with
/// the transaction.</para>
/// </summary>
[ResourceExposure(ResourceScope.Machine)]
// The TransactedRegistryKey's members cannot be changed.
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
internal static readonly TransactedRegistryKey Users = TransactedRegistryKey.GetBaseKey(BaseRegistryKeys.HKEY_USERS);
@@ -118,7 +114,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// subkeys, there must be a Transaction.Current and the resulting TransactedRegistryKey from those operations ARE associated with
/// the transaction.</para>
/// </summary>
[ResourceExposure(ResourceScope.Machine)]
// The TransactedRegistryKey's members cannot be changed.
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
internal static readonly TransactedRegistryKey CurrentConfig = TransactedRegistryKey.GetBaseKey(BaseRegistryKeys.HKEY_CURRENT_CONFIG);
@@ -346,8 +346,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// otherwise an ArgumentException is thrown.</param>
/// <returns>A TransactedRegistryKey object for the subkey, which is associated with Transaction.Current.
/// returns null if the operation failed.</returns>
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public TransactedRegistryKey CreateSubKey(string subkey)
@@ -366,8 +364,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// <param name='permissionCheck'>One of the Microsoft.Win32.RegistryKeyPermissionCheck values that
/// specifies whether the key is opened for read or read/write access.</param>
[ComVisible(false)]
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public TransactedRegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck)
@@ -387,8 +383,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// specifies whether the key is opened for read or read/write access.</param>
/// <param name='registrySecurity'>A TransactedRegistrySecurity object that specifies the access control security for the new key.</param>
[ComVisible(false)]
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public unsafe TransactedRegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, TransactedRegistrySecurity registrySecurity)
@@ -397,8 +391,6 @@ namespace Microsoft.PowerShell.Commands.Internal
}
[ComVisible(false)]
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
private unsafe TransactedRegistryKey CreateSubKeyInternal(string subkey, RegistryKeyPermissionCheck permissionCheck, object registrySecurityObj)
@@ -489,8 +481,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// <exception cref="InvalidOperationException">Thrown if the subkey as child subkeys.</exception>
/// </summary>
/// <param name='subkey'>The subkey to delete.</param>
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public void DeleteSubKey(string subkey)
@@ -510,8 +500,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// <param name='throwOnMissingSubKey'>Specify true if an ArgumentException should be thrown if
/// the specified subkey does not exist. If false is specified, a missing subkey does not throw
/// an exception.</param>
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public void DeleteSubKey(string subkey, bool throwOnMissingSubKey)
@@ -569,8 +557,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// Utilizes Transaction.Current for its transaction.</para>
/// </summary>
/// <param name="subkey">The subkey to delete.</param>
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public void DeleteSubKeyTree(string subkey)
@@ -626,8 +612,6 @@ namespace Microsoft.PowerShell.Commands.Internal
// An internal version which does no security checks or argument checking. Skipping the
// security checks should give us a slight perf gain on large trees.
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
private void DeleteSubKeyTreeInternal(string subkey)
@@ -672,8 +656,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// Utilizes Transaction.Current for its transaction.</para>
/// </summary>
/// <param name="name">Name of the value to delete.</param>
[ResourceExposure(ResourceScope.None)]
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
public void DeleteValue(string name)
{
DeleteValue(name, true);
@@ -687,8 +669,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// <param name="throwOnMissingValue">Specify true if an ArgumentException should be thrown if
/// the specified value does not exist. If false is specified, a missing value does not throw
/// an exception.</param>
[ResourceExposure(ResourceScope.None)]
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
public void DeleteValue(string name, bool throwOnMissingValue)
{
EnsureWriteable();
@@ -758,8 +738,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// <returns>The subkey requested or null if the operation failed.</returns>
/// <param name="name">Name or path of the subkey to open.</param>
/// <param name="writable">Set to true of you only need readonly access.</param>
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public TransactedRegistryKey OpenSubKey(string name, bool writable)
@@ -803,8 +781,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// <param name="permissionCheck">One of the Microsoft.Win32.RegistryKeyPermissionCheck values that specifies
/// whether the key is opened for read or read/write access.</param>
[ComVisible(false)]
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public TransactedRegistryKey OpenSubKey(string name, RegistryKeyPermissionCheck permissionCheck)
@@ -823,8 +799,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// whether the key is opened for read or read/write access.</param>
/// <param name="rights">A bitwise combination of Microsoft.Win32.RegistryRights values that specifies the desired security access.</param>
[ComVisible(false)]
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public TransactedRegistryKey OpenSubKey(string name, RegistryKeyPermissionCheck permissionCheck, RegistryRights rights)
@@ -832,8 +806,6 @@ namespace Microsoft.PowerShell.Commands.Internal
return InternalOpenSubKey(name, permissionCheck, (int)rights);
}
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
private TransactedRegistryKey InternalOpenSubKey(string name, RegistryKeyPermissionCheck permissionCheck, int rights)
@@ -874,8 +846,6 @@ namespace Microsoft.PowerShell.Commands.Internal
// This required no security checks. This is to get around the Deleting SubKeys which only require
// write permission. They call OpenSubKey which required read. Now instead call this function w/o security checks
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
internal TransactedRegistryKey InternalOpenSubKey(string name, bool writable)
@@ -906,8 +876,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// </summary>
/// <returns>The subkey requested or null if the operation failed.</returns>
/// <param name="name">Name or path of the subkey to open.</param>
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
// Suppressed to be consistent with naming in Microsoft.Win32.RegistryKey
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public TransactedRegistryKey OpenSubKey(string name)
@@ -106,7 +106,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// <param name="peUse"></param>
/// <returns></returns>
[DllImport(PinvokeDllNames.LookupAccountSidDllName, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
[ResourceExposure(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern unsafe bool LookupAccountSid(string lpSystemName,
@@ -139,7 +138,6 @@ namespace Microsoft.PowerShell.Commands.Internal
}
[DllImport(PinvokeDllNames.CloseHandleDllName, SetLastError = true)]
[ResourceExposure(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool CloseHandle(IntPtr handle);
@@ -152,7 +150,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// <param name="tokenHandle">Process token.</param>
/// <returns>The current process token.</returns>
[DllImport(PinvokeDllNames.OpenProcessTokenDllName, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
[ResourceExposure(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool OpenProcessToken(IntPtr processHandle, uint desiredAccess, out IntPtr tokenHandle);
@@ -168,7 +165,6 @@ namespace Microsoft.PowerShell.Commands.Internal
/// <param name="returnLength"></param>
/// <returns></returns>
[DllImport(PinvokeDllNames.GetTokenInformationDllName, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
[ResourceExposure(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool GetTokenInformation(IntPtr tokenHandle,