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.

System path redirection is applied to the values of certain parameters that take paths — see Entry Bitness for the full list. Paths starting with {sys} (or other value expanding to x:\Windows\System32) are automatically rewritten if needed so that on 64-bit entries, it is the 64-bit System directory that is accessed, and on 32-bit entries, it is the 32-bit System directory that is accessed.

For example, on 64-bit Windows, in this case:

[Files]
Source: "MyLibrary.dll"; DestDir: "{sys}"; Flags: 32bit

the file is actually installed to SysWOW64 (32-bit), not System32 (64-bit). But in this case:

[Files]
Source: "MyLibrary.dll"; DestDir: "{sys}"; Flags: 64bit

the file is installed to System32 (64-bit). Behind the scenes, however, 32-bit installers access the directory under the alias Sysnative (see table below).

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:

Entry 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 entry 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 entries, Sysnative should only be present in 32-bit entries.

[1] With the ApplyPathRedirRules support function, the A64Bit parameter specifies the "entry bitness".

[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).