# I hit [a bug in VS Code](https://github.com/Microsoft/vscode/issues/27915) recently related to running a 32-bit process on a 64-bit machine that was interesting. Here’s what I learned.

## The System32 directory [#](/content/2017/08/windows-wow64.html#the-system32-directory/index.html)

On 64-bit Windows `%windir%\System32` holds the 64-bit binaries. Accesses to this directory on 32-bit processes are automatically redirected to `SysWoW64`, in order to be backwards compatible.

## The SysWoW64 directory [#](/content/2017/08/windows-wow64.html#the-syswow64-directory/index.html)

On 64-bit Windows `%windir%\SysWoW64` holds the 32-bit binaries. This confused me initially until I learned that WoW64 stands for **W** indows 32-bit **o** n **W** indows **64**-bit.

## The Sysnative directory [#](/content/2017/08/windows-wow64.html#the-sysnative-directory/index.html)

`%windir%\Sysnative` only exists on 32-bit processes running on 64-bit Windows and it redirects to the _actual_`System32`, allowing access to the 64-bit binaries on 32-bit _processes_. Initially I mistakenly assumed that `Sysnative` was a standard symlink that always points at the 64-bit binaries if they’re available, but this is not the case.

## Directory overview [#](/content/2017/08/windows-wow64.html#directory-overview/index.html)

|  | 32-bit process | 64-bit process |
| --- | --- | --- |
| `System32` | -\> SysWoW64 (32-bit binaries) | 64-bit binaries |
| `SysWoW64` | 32-bit binaries | 32-bit binaries |
| `Sysnative` | -\> System32 (64-bit binaries) | N/A |

## Detecting WoW64 processes [#](/content/2017/08/windows-wow64.html#detecting-wow64-processes/index.html)

That’s all very well and good, but how do you detect that you’re a 32-bit process running on 64-bit Windows? There are a couple of environment variables that come in handy here.

`PROCESSOR_ARCHITECTURE` will give you the actual processor architecture; `"x86"`, `"AMD64"` or `"IA64"`.

`PROCESSOR_ARCHITEW6432` will give the same value as `PROCESSOR_ARCHITECTURE`, but it’s only set on 32-bit processes. To detect whether you’re in a WoW64 environment, just check whether the `PROCESSOR_ARCHITEW6432` exists in the environment.

## References [#](/content/2017/08/windows-wow64.html#references/index.html)

- [Programming Guide for 64-bit Windows - WOW64 Implementation Details](https://msdn.microsoft.com/en-us/library/aa384274.aspx)
- [Programming Guide for 64-bit Windows - File System Redirector](https://msdn.microsoft.com/en-us/library/aa384187(v=vs.85).aspx)
