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.
24 lines
755 B
C#
24 lines
755 B
C#
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());
|
|
}
|
|
}
|