Fix thread namespace collision and tighten executable stub allocation

Fully qualifies System.Threading.Thread in DllInjector after introducing the WhiteMagic.Thread namespace, and replaces the broken+too-small near-allocation loop with a symmetric +/-2 GiB search so the x64 call stub always lands within rel32 range.
This commit is contained in:
kbe
2026-07-22 16:04:41 +02:00
parent 9aef9c21e3
commit 8f988768fe
3 changed files with 35 additions and 38 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
using System.Runtime.InteropServices;
using Thread = System.Threading.Thread;
using WhiteMagic;
using WhiteMagic.Injection;
using WhiteMagic.Native;
@@ -69,7 +70,7 @@ public class DllInjectorTests
int osThreadId = 0;
Exception? threadError = null;
var helper = new Thread(() =>
var helper = new System.Threading.Thread(() =>
{
try
{
@@ -80,7 +81,7 @@ public class DllInjectorTests
// also be stopped once its original context is restored.
while (!stopEvent.IsSet)
{
Thread.Sleep(10);
System.Threading.Thread.Sleep(10);
}
}
catch (Exception ex)