Implement core diagnostic memory layer, execution helpers, and high-level facade slices
Implemented: - Core: UTF-16 ReadString boundary/alignment fix, target bitness and process id on MemoryBase - function interception: PatchManager, DetourManager, InstructionAnalyzer, MainThreadDispatcher - Execution: BackgroundTaskExecutor, InProcessInvoker - High-level: Magic facade, RemotePointer, async wrappers - Discovery/external code loading/Window groundwork (PEB/TEB, pattern scanning, raw allocations, DLL external code loading, window/input) Tests: 180 passing, 4 integration/interactive tests skipped.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using WhiteMagic;
|
||||
using WhiteMagic.Native;
|
||||
using WhiteMagic.ThreadEnvironment;
|
||||
using Xunit;
|
||||
|
||||
namespace WhiteMagicTest.ThreadEnvironment;
|
||||
|
||||
public sealed class ManagedTebTests
|
||||
{
|
||||
[Fact]
|
||||
public void Read_current_thread_teb_fields_returns_plausible_values()
|
||||
{
|
||||
using var magic = Magic.OpenInProcess();
|
||||
using var teb = new ManagedTeb(magic.Memory, (int)NativeMethods.GetCurrentThreadId());
|
||||
|
||||
Assert.NotEqual(IntPtr.Zero, teb.ReadTebAddress());
|
||||
Assert.NotEqual(IntPtr.Zero, teb.ReadStackBase());
|
||||
Assert.NotEqual(IntPtr.Zero, teb.ReadStackLimit());
|
||||
|
||||
// The stack grows down, so the base is above the limit on x86/x64.
|
||||
Assert.True((nuint)teb.ReadStackBase() > (nuint)teb.ReadStackLimit());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user