From 97f75ae34cdaa4e52271d74f7a8c8de573ea2393 Mon Sep 17 00:00:00 2001 From: DreamingCodes Date: Tue, 7 Apr 2026 13:41:47 -0700 Subject: [PATCH 1/2] fix: guard breakpoint() with x86 check for ARM64 Windows support The breakpoint() function uses x86-specific intrinsics (__stosb, __movsb) and x86 debug registers (Dr0, Dr7 from CONTEXT) that don't exist on ARM64 Windows. This causes compilation to fail when targeting aarch64-pc-windows-msvc. Added the same #if (!x86) return false; #endif guard that msr() already uses. --- src/vmaware.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vmaware.hpp b/src/vmaware.hpp index 792fd8c5..4c47695f 100644 --- a/src/vmaware.hpp +++ b/src/vmaware.hpp @@ -11956,6 +11956,9 @@ struct VM { * @implements VM::BREAKPOINT */ [[nodiscard]] static bool breakpoint() { + #if (!x86) + return false; + #endif const HMODULE ntdll = util::get_ntdll(); if (!ntdll) return false; From 0b22a2c38ade11b02a2a611b414c1344cd9d7758 Mon Sep 17 00:00:00 2001 From: DreamingCodes Date: Tue, 7 Apr 2026 13:50:58 -0700 Subject: [PATCH 2/2] fix: use #else instead of #endif for x86 guards in msr(), kvm_interception(), and breakpoint() The previous pattern (#if (!x86) return false; #endif) inserts an early return but the compiler still compiles the code below. MSVC on ARM64 fails because x86-specific intrinsics (__readmsr, __stosb, __movsb) and x86 debug registers (Dr0, Dr7) don't exist on that platform. Changed all three functions to use #if (!x86) return false; #else ... #endif so the x86-specific code is completely excluded from compilation on non-x86 targets. --- src/vmaware.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vmaware.hpp b/src/vmaware.hpp index 4c47695f..97841c9d 100644 --- a/src/vmaware.hpp +++ b/src/vmaware.hpp @@ -11797,7 +11797,7 @@ struct VM { [[nodiscard]] static bool msr() { #if (!x86) return false; - #endif + #else constexpr u32 random_msr = 0xDEADBEEFu; auto try_read = [](u32 msr_index) -> bool { @@ -11849,6 +11849,7 @@ struct VM { } return false; + #endif } @@ -11861,7 +11862,7 @@ struct VM { [[nodiscard]] static bool kvm_interception() { #if (!x86) return false; - #endif + #else using nt_allocate_virtual_memory_t = NTSTATUS(__stdcall*)(HANDLE, PVOID*, ULONG_PTR, PSIZE_T, ULONG, ULONG); using nt_protect_virtual_memory_t = NTSTATUS(__stdcall*)(HANDLE, PVOID*, PSIZE_T, ULONG, PULONG); using nt_free_virtual_memory_t = NTSTATUS(__stdcall*)(HANDLE, PVOID*, PSIZE_T, ULONG); @@ -11947,6 +11948,7 @@ struct VM { } return false; + #endif } @@ -11958,7 +11960,7 @@ struct VM { [[nodiscard]] static bool breakpoint() { #if (!x86) return false; - #endif + #else const HMODULE ntdll = util::get_ntdll(); if (!ntdll) return false; @@ -12072,6 +12074,7 @@ struct VM { nt_free_virtual_memory(current_process, &dst_page, &free_size, MEM_RELEASE); return !ermsb_trap_detected; + #endif } // ADD NEW TECHNIQUE FUNCTION HERE #endif