/ Tools

Inno setup insists to copy files to SysWOW64

I'm trying to copy a file to system32 folder, I use `{sys}` constant provided by Inno Setup.

First failure

The script for this file looks like this

``````Source: "..\Release\kernel_driver\mydriver.sys"; DestDir: "{sys}\drivers"; Permissions: admins-full
``````

This should copy the file to `C:\Windows\System32\drivers\mhydriver.sys`
So this obviously failed since I'm writing this post...The file is copied to this path instead `C:\Windows\SysWOW64\drivers`

Second failure

After some research, it turns out `{sys}` constant isn't just mapped to `system32`. To test if this is really the cause, I tried to use an absolute path like this

``````Source: "..\Release\kernel_driver\mydriver.sys"; DestDir: "C:\Windows\System32\drivers"; Permissions: admins-full
``````

Sadly, the file shows in `SysWOW64` again.

The actual cause

After this simple test, the problem is not about the `{sys}` constant. This behaviour is caused by "windows file system redirection" on 64 bits windows running 32 bits application. Windows redirects the file intended to `system32` to `sysWOW64` silently.

Solution

We can either disable the feature by calling `Wow64DisableWow64FsRedirection` or we can simply tell Inno Setup to flag the file as 64 bit.

``````Source: "..\Release\kernel_driver\mhydriver.sys"; DestDir: "{sys}\drivers"; Flags: 64bit; Permissions: admins-full
``````

Install again and claps.

mimimi

Currently a Computer Engineering student at the National University of Singapore, passionate about software engineering. Contact me: info at mimimi.fun

Inno setup insists to copy files to SysWOW64