Skip to content

Commit ce9b899

Browse files
cdervclaude
andcommitted
docs(windows): document IsWow64Process2 approach for ARM detection
Add comprehensive documentation explaining why kernel32.dll FFI is needed and safe. Links to validation repo and Microsoft API documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ba90b6a commit ce9b899

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/core/windows.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,17 @@ export async function safeWindowsExec(
166166

167167
// Detect Windows ARM hardware using IsWow64Process2 API
168168
// Returns true if running on ARM64 hardware (even from x64 Deno under emulation)
169+
//
170+
// Background: Deno.build.arch reports the architecture Deno was compiled for,
171+
// not the actual hardware architecture. When x64 Deno runs on ARM64 under
172+
// WOW64 emulation, Deno.build.arch still reports "x86_64".
173+
//
174+
// Solution: Use Windows IsWow64Process2 API which returns the native machine
175+
// architecture regardless of emulation. This is a standard Windows API function
176+
// available since Windows 10 (kernel32.dll is always present on Windows).
177+
//
178+
// Reference: Validated approach from https://github.com/cderv/quarto-windows-arm
179+
// See: https://learn.microsoft.com/en-us/windows/win32/api/wow64apiset/nf-wow64apiset-iswow64process2
169180
export function isWindowsArm(): boolean {
170181
if (!isWindows) {
171182
return false;

0 commit comments

Comments
 (0)