System Path Redirection

On 64-bit Windows, there are two "System" directories: one containing 64-bit DLLs/EXEs, called System32 on disk, and one containing 32-bit DLLs/EXEs, called SysWOW64 on disk.

In certain contexts where paths are specified, such as the DestDir parameter of the [Files] section, system path redirection is applied. Paths starting with {sys} (or other value expanding to x:\Windows\System32) are automatically rewritten if needed so that in 64-bit install mode, it is the 64-bit System directory that is accessed, and in 32-bit install mode, it is the 32-bit System directory that is accessed.

No rewriting occurs on systems running 32-bit Windows, as System32 is the only System directory. SysWOW64 doesn't exist, and the Sysnative alias isn't supported.

Paths are rewritten according to the following rules:

Input path bitness[1] Target process bitness[2] Substitution made Explanation
64-bit 32-bit System32Sysnative 32-bit processes have to use the Sysnative alias to reach the "real" 64-bit System32 directory.
32-bit 64-bit System32SysWOW64

64-bit processes can only access the 32-bit System directory as SysWOW64.

All subdirectories are redirected as well; there are no exemptions.

32-bit 32-bit

Usually:
System32SysWOW64

In special cases:
SysWOW64System32

In 32-bit processes, WOW64 file system redirection [external link] already routes System32 to SysWOW64, but certain subdirectories are exempt (one example: System32\drivers\etc). Explicitly changing System32SysWOW64 bypasses those exemptions, keeping the redirection consistent with the 64-bit target process rule above.

In a few special cases, the rule is flipped to SysWOW64System32. These cases are:

  • when setting values in the 32-bit SharedDLLs registry key, because SysWOW64 isn't used there
  • when passing paths to the 32-bit regsvr32.exe, because DLLs are traditionally registered with a System32 path
  • when registering/unregistering type libraries in 32-bit Setup/Uninstall, because type libraries are traditionally registered with a System32 path
  • when the ApplyPathRedirRules support function is called with tp32BitPreferSystem32 in the target process parameter
64-bit 64-bit System32no change System32 is correct as-is when the input path and target process are both 64-bit.
Any 64-bit SysnativeSystem32

64-bit processes cannot use the Sysnative alias; it is only available in 32-bit processes.

Although this rule is applied for both 32-bit and 64-bit input paths, Sysnative should only be present in 32-bit input paths.

[1] By default, the "input path bitness" is the same as Setup/Uninstall's install mode — 32-bit in 32-bit install mode, and 64-bit in 64-bit install mode. In the [Files] and [Run] sections, the path bitness can be overridden on a per-entry basis using the 32bit and 64bit flags.

[2] "Target process" is the process where the rewritten path will ultimately be accessed. In most cases, paths are accessed by Setup/Uninstall itself, so the target process bitness is Setup/Uninstall's bitness (as set by SetupArchitecture).