Remove ArchitectureSensitiveAttribute from the code base (#18598)

This commit is contained in:
Ilya
2022-11-18 14:15:05 -08:00
committed by GitHub
parent c0da3c42f2
commit 6aa74c5c3c
11 changed files with 2 additions and 49 deletions
@@ -1680,7 +1680,6 @@ namespace Microsoft.PowerShell.Commands
#region Overrides
/// <summary>
/// </summary>
[ArchitectureSensitive]
protected override void ProcessRecord()
{
ServiceController service = null;
@@ -1759,7 +1758,7 @@ namespace Microsoft.PowerShell.Commands
var access = NativeMethods.SERVICE_CHANGE_CONFIG;
if (!string.IsNullOrEmpty(SecurityDescriptorSddl))
access |= NativeMethods.WRITE_DAC | NativeMethods.WRITE_OWNER;
hService = NativeMethods.OpenServiceW(
hScManager,
Name,
@@ -2115,7 +2114,6 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Create the service.
/// </summary>
[ArchitectureSensitive]
protected override void BeginProcessing()
{
ServiceController service = null;
@@ -2384,7 +2382,6 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Remove the service.
/// </summary>
[ArchitectureSensitive]
protected override void ProcessRecord()
{
ServiceController service = null;
@@ -48,7 +48,6 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Set the date.
/// </summary>
[ArchitectureSensitive]
protected override void ProcessRecord()
{
DateTime dateToUse;
@@ -3547,7 +3547,6 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Get a list of store names at the specified location.
/// </summary>
[ArchitectureSensitive]
internal static List<string> GetStoreNamesAtLocation(StoreLocation location)
{
SMASecurity.NativeMethods.CertStoreFlags locationFlag =
@@ -203,7 +203,6 @@ namespace System.Management.Automation
/// </summary>
/// <param name="typeinfo">Reference to ITypeInfo from which to get TypeAttr.</param>
/// <returns></returns>
[ArchitectureSensitive]
internal static COM.TYPEATTR GetTypeAttr(COM.ITypeInfo typeinfo)
{
IntPtr pTypeAttr;
@@ -218,7 +217,6 @@ namespace System.Management.Automation
/// <param name="typeinfo"></param>
/// <param name="index"></param>
/// <returns></returns>
[ArchitectureSensitive]
internal static COM.FUNCDESC GetFuncDesc(COM.ITypeInfo typeinfo, int index)
{
IntPtr pFuncDesc;
@@ -1096,7 +1096,6 @@ namespace System.Management.Automation
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
[ArchitectureSensitive]
private static bool IsWindowsApplication(string fileName)
{
#if UNIX
@@ -1610,7 +1609,6 @@ namespace System.Management.Automation
private static extern IntPtr FindExecutableW(
string fileName, string directoryPath, StringBuilder pathFound);
[ArchitectureSensitive]
private static string FindExecutable(string filename)
{
// Preallocate a
@@ -373,7 +373,6 @@ namespace System.Management.Automation
}
}
[ArchitectureSensitive]
internal static string GetStringFromSecureString(SecureString ss)
{
IntPtr p = IntPtr.Zero;
@@ -96,7 +96,6 @@ namespace System.Management.Automation
/// <exception cref="System.IO.FileNotFoundException">
/// Thrown if the file specified by argument fileName is not found
/// </exception>
[ArchitectureSensitive]
internal static Signature SignFile(SigningOption option,
string fileName,
X509Certificate2 certificate,
@@ -116,7 +115,7 @@ namespace System.Management.Automation
if (!string.IsNullOrEmpty(timeStampServerUrl))
{
if ((timeStampServerUrl.Length <= 7) || (
(timeStampServerUrl.IndexOf("http://", StringComparison.OrdinalIgnoreCase) != 0) &&
(timeStampServerUrl.IndexOf("http://", StringComparison.OrdinalIgnoreCase) != 0) &&
(timeStampServerUrl.IndexOf("https://", StringComparison.OrdinalIgnoreCase) != 0)))
{
throw PSTraceSource.NewArgumentException(
@@ -276,7 +275,6 @@ namespace System.Management.Automation
/// <exception cref="System.IO.FileNotFoundException">
/// Thrown if the file specified by argument fileName is not found.
/// </exception>
[ArchitectureSensitive]
internal static Signature GetSignature(string fileName, string fileContent)
{
Signature signature = null;
@@ -443,7 +441,6 @@ namespace System.Management.Automation
return signature;
}
[ArchitectureSensitive]
private static uint GetWinTrustData(string fileName, string fileContent,
out WinTrustMethods.WINTRUST_DATA wtData)
{
@@ -498,7 +495,6 @@ namespace System.Management.Automation
}
}
[ArchitectureSensitive]
private static X509Certificate2 GetCertFromChain(IntPtr pSigner)
{
try
@@ -516,7 +512,6 @@ namespace System.Management.Automation
}
}
[ArchitectureSensitive]
private static Signature GetSignatureFromWintrustData(
string filePath,
uint error,
@@ -562,7 +557,6 @@ namespace System.Management.Automation
return signature;
}
[ArchitectureSensitive]
private static bool TryGetProviderSigner(IntPtr wvtStateData, out IntPtr pProvSigner, out X509Certificate2 timestamperCert)
{
pProvSigner = IntPtr.Zero;
@@ -596,7 +590,6 @@ namespace System.Management.Automation
}
}
[ArchitectureSensitive]
private static uint GetLastWin32Error()
{
int error = Marshal.GetLastWin32Error();
@@ -68,7 +68,6 @@ namespace Microsoft.PowerShell
/// </summary>
/// <param name="s">Input string.</param>
/// <returns>Contents of s (char[]) converted to byte[].</returns>
[ArchitectureSensitive]
internal static byte[] GetData(SecureString s)
{
//
@@ -495,7 +495,6 @@ namespace System.Management.Automation.Internal
/// </summary>
/// <param name="path">The path to the file in question.</param>
/// <param name="handle">A file handle to the file in question, if available.</param>
[ArchitectureSensitive]
[SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods")]
internal static SaferPolicy GetSaferPolicy(string path, SafeHandle handle)
{
@@ -682,7 +681,6 @@ namespace System.Management.Automation.Internal
/// </summary>
/// <param name="cert">Certificate object.</param>
/// <returns>A collection of cert eku strings.</returns>
[ArchitectureSensitive]
internal static Collection<string> GetCertEKU(X509Certificate2 cert)
{
Collection<string> ekus = new Collection<string>();
@@ -620,7 +620,6 @@ namespace System.Management.Automation.Security
internal IntPtr psUnauthenticatedNotUsed; // PCRYPT_ATTRIBUTES
}
[ArchitectureSensitive]
internal static CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO
InitSignInfoExtendedStruct(string description,
string moreInfoUrl,
@@ -724,7 +723,6 @@ namespace System.Management.Automation.Security
System.IntPtr pvKey,
uint dwGroupId);
[ArchitectureSensitive]
internal static DWORD GetCertChoiceFromSigningOption(
SigningOption option)
{
@@ -752,7 +750,6 @@ namespace System.Management.Automation.Security
return cc;
}
[ArchitectureSensitive]
internal static CRYPTUI_WIZ_DIGITAL_SIGN_INFO
InitSignInfoStruct(string fileName,
X509Certificate2 signingCert,
@@ -1,24 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace System.Management.Automation.Internal
{
/// <summary>
/// This attribute is used for Design For Testability.
/// It should be placed on any method containing code
/// which is likely to be sensitive to X86/X64/IA64 issues,
/// primarily code which calls DllImports or otherwise uses
/// NativeMethods. This allows us to generate code coverage
/// data specific to architecture sensitive code.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
internal class ArchitectureSensitiveAttribute : Attribute
{
/// <summary>
/// Constructor for the ArchitectureSensitiveAttribute class.
/// </summary>
internal ArchitectureSensitiveAttribute()
{
}
}
}