mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Address static analysis issues in SSH remoting (#4083)
* address static analysis issues - remoteRunspaces is not used TFS:10618323 - not checking return value of ResumeThread() TFS:10618344 * fixed magic number use * changed magic number to Uint.MaxValue
This commit is contained in:
@@ -1360,7 +1360,6 @@ namespace Microsoft.PowerShell.Commands
|
||||
protected void CreateHelpersForSpecifiedSSHHashComputerNames()
|
||||
{
|
||||
var sshConnections = ParseSSHConnectionHashTable();
|
||||
var remoteRunspaces = new List<RemoteRunspace>();
|
||||
foreach (var sshConnection in sshConnections)
|
||||
{
|
||||
var sshConnectionInfo = new SSHConnectionInfo(
|
||||
|
||||
@@ -2483,7 +2483,12 @@ namespace System.Management.Automation.Runspaces
|
||||
|
||||
// At this point, we should have a suspended process. Get the .Net Process object, resume the process, and return.
|
||||
Process result = Process.GetProcessById(lpProcessInformation.dwProcessId);
|
||||
PlatformInvokes.ResumeThread(lpProcessInformation.hThread);
|
||||
uint returnValue = PlatformInvokes.ResumeThread(lpProcessInformation.hThread);
|
||||
|
||||
if (returnValue == PlatformInvokes.RESUME_THREAD_FAILED)
|
||||
{
|
||||
throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -701,6 +701,7 @@ namespace System.Management.Automation
|
||||
|
||||
[DllImport(PinvokeDllNames.ResumeThreadDllName, CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
public static extern uint ResumeThread(IntPtr threadHandle);
|
||||
internal static uint RESUME_THREAD_FAILED = System.UInt32.MaxValue; // (DWORD)-1
|
||||
|
||||
[DllImport(PinvokeDllNames.CreateFileDllName, CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
public static extern System.IntPtr CreateFileW(
|
||||
|
||||
Reference in New Issue
Block a user