From 963bf8ae084ce6fd3e59aaa5a3763f70f56d3c19 Mon Sep 17 00:00:00 2001 From: Exverge Date: Fri, 17 Jul 2026 18:15:41 -0400 Subject: [PATCH] [nce] disable control flow guard on win32 --- src/core/arm/nce/arm_nce.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/arm/nce/arm_nce.cpp b/src/core/arm/nce/arm_nce.cpp index 66213a7d16..a2a47bf003 100644 --- a/src/core/arm/nce/arm_nce.cpp +++ b/src/core/arm/nce/arm_nce.cpp @@ -625,7 +625,15 @@ void ArmNce::Initialize() { }); #else static std::once_flag flag; - std::call_once(flag, [] { AddVectoredExceptionHandler(1, VectoredExceptionHandler); }); + std::call_once(flag, [] { + // Initialize exception handler + AddVectoredExceptionHandler(1, VectoredExceptionHandler); + + // Disable control flow guard to allow context switching to guest code without causing a security error + PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY cfg_policy{}; + cfg_policy.EnableControlFlowGuard = 0; + SetProcessMitigationPolicy(ProcessControlFlowGuardPolicy, &cfg_policy, sizeof(cfg_policy)); + }); #endif }