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:
kbe
2026-07-22 17:18:48 +02:00
parent 3e294dc846
commit 1169fdb994
6 changed files with 78 additions and 19 deletions
+10 -3
View File
@@ -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>