Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ public sealed class TransactedRegistryKey : MarshalByRefObject, IDisposable
// If that call fails with ERROR_INVALID_TRANSACTION, we have possibly run into bug 181242. To workaround
// this, we open the key without a transaction and then open it again with
// a transaction and return THAT hkey.

// Suppressed because there is no way for arbitrary data to be passed.
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
private int RegOpenKeyTransactedWrapper(SafeRegistryHandle hKey, string lpSubKey,
int ulOptions, int samDesired, out SafeRegistryHandle hkResult,
SafeTransactionHandle hTransaction, IntPtr pExtendedParameter)
Expand Down
4 changes: 0 additions & 4 deletions src/System.Management.Automation/namespaces/Win32Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ internal struct TOKEN_USER
/// <param name="peUse"></param>
/// <returns></returns>
[DllImport(PinvokeDllNames.LookupAccountSidDllName, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern unsafe bool LookupAccountSid(string lpSystemName,
IntPtr sid,
Expand Down Expand Up @@ -138,7 +137,6 @@ internal static unsafe bool LookupAccountSid(string lpSystemName,
}

[DllImport(PinvokeDllNames.CloseHandleDllName, SetLastError = true)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool CloseHandle(IntPtr handle);

Expand All @@ -150,7 +148,6 @@ internal static unsafe bool LookupAccountSid(string lpSystemName,
/// <param name="tokenHandle">Process token.</param>
/// <returns>The current process token.</returns>
[DllImport(PinvokeDllNames.OpenProcessTokenDllName, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool OpenProcessToken(IntPtr processHandle, uint desiredAccess, out IntPtr tokenHandle);

Expand All @@ -165,7 +162,6 @@ internal static unsafe bool LookupAccountSid(string lpSystemName,
/// <param name="returnLength"></param>
/// <returns></returns>
[DllImport(PinvokeDllNames.GetTokenInformationDllName, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool GetTokenInformation(IntPtr tokenHandle,
TOKEN_INFORMATION_CLASS tokenInformationClass,
Expand Down
6 changes: 0 additions & 6 deletions src/System.Management.Automation/utils/PlatformInvokes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ internal static extern IntPtr CreateFile(
/// </returns>
[DllImport(PinvokeDllNames.CloseHandleDllName, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
// [SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
internal static extern bool CloseHandle(IntPtr handle);

[DllImport(PinvokeDllNames.DosDateTimeToFileTimeDllName, SetLastError = false)]
Expand Down Expand Up @@ -412,7 +411,6 @@ internal static bool RestoreTokenPrivilege(string privilegeName, ref TOKEN_PRIVI
/// <param name="lpLuid"></param>
/// <returns></returns>
[DllImport(PinvokeDllNames.LookupPrivilegeValueDllName, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool LookupPrivilegeValue(string lpSystemName, string lpName, ref LUID lpLuid);

Expand All @@ -424,7 +422,6 @@ internal static bool RestoreTokenPrivilege(string privilegeName, ref TOKEN_PRIVI
/// <param name="pfResult"></param>
/// <returns></returns>
[DllImport(PinvokeDllNames.PrivilegeCheckDllName, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool PrivilegeCheck(IntPtr tokenHandler, ref PRIVILEGE_SET requiredPrivileges, out bool pfResult);

Expand All @@ -441,7 +438,6 @@ internal static bool RestoreTokenPrivilege(string privilegeName, ref TOKEN_PRIVI
/// <param name="returnLength"></param>
/// <returns></returns>
[DllImport(PinvokeDllNames.AdjustTokenPrivilegesDllName, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool AdjustTokenPrivileges(IntPtr tokenHandler, bool disableAllPrivilege,
ref TOKEN_PRIVILEGE newPrivilegeState, int bufferLength,
Expand Down Expand Up @@ -482,7 +478,6 @@ internal struct PRIVILEGE_SET
/// </summary>
/// <returns></returns>
[DllImport(PinvokeDllNames.GetCurrentProcessDllName)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
internal static extern IntPtr GetCurrentProcess();

/// <summary>
Expand All @@ -494,7 +489,6 @@ internal struct PRIVILEGE_SET
/// <param name="tokenHandle">Process token.</param>
/// <returns>The current process token.</returns>
[DllImport(PinvokeDllNames.OpenProcessTokenDllName, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool OpenProcessToken(IntPtr processHandle, uint desiredAccess, out IntPtr tokenHandle);

Expand Down
Loading