Address review findings for thread control and process discovery
- Drop the false WOW64 claim from GetContext32/SetContext32 docs and guard them for 32-bit targets only.\n- Make FrozenThread dispose the thread handles it owns; make Freeze(predicate) dispose filtered-out threads.\n- Pass the already-validated handle through GetThreadById instead of opening a second one.\n- Add no-progress guard to MemoryBase.EnumerateRegions.\n- Dispose unmatched Process candidates in ApplicationFinder.OpenProcess.\n- Clean up RemoteThreadExecutor allocation formatting.
This commit is contained in:
@@ -41,12 +41,19 @@ public static class ApplicationFinder
|
||||
|
||||
if (candidates.Length > 1)
|
||||
{
|
||||
string list = string.Join(", ", candidates.Select(p => $"{p.ProcessName}:{p.Id}"));
|
||||
foreach (Process candidate in candidates)
|
||||
candidate.Dispose();
|
||||
|
||||
throw new InvalidOperationException(
|
||||
$"Process name '{processName}' is ambiguous ({candidates.Length} matches): " +
|
||||
string.Join(", ", candidates.Select(p => $"{p.ProcessName}:{p.Id}")));
|
||||
$"Process name '{processName}' is ambiguous ({candidates.Length} matches): {list}");
|
||||
}
|
||||
|
||||
return candidates[0];
|
||||
Process result = candidates[0];
|
||||
for (int i = 1; i < candidates.Length; i++)
|
||||
candidates[i].Dispose();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user