How to install .sys file into c:\\windows\\system3

2019-06-12 00:00发布

问题:

This question already has an answer here:

  • File/DLL installed to {sys} does not appear in C:\Windows\system32 1 answer

I try to simply install a .sys file into

Source: "C:\myproject\driver.sys"; DestDir: "{win}\system32\drivers"; 

Once the setup ran, my driver.sys is always installed into

C:\Windows\SysWOW64\drivers

Any idea why?

回答1:

By default the {win}\system32 is redirected to {win}\SysWOW64 by the OS for 32-bit applications (like Inno Setup).

You can override this using 64bit flag:

Source: "C:\myproject\driver.sys"; DestDir: "{win}\system32\drivers"; Flags: 64bit 

64bit: Causes the {sys} constant to map to the 64-bit System directory when used in the Source and DestDir parameters, .... This is the default behavior in a 64-bit mode install.


Or enable 64-bit mode install.

[Setup]
ArchitecturesInstallIn64BitMode=x64 ia64

In 64-bit mode:

  • The System32 path returned by the {sys} constant maps to the 64-bit System directory by default when used in the [Dirs], [Files], [InstallDelete], [Run], [UninstallDelete], and [UninstallRun] sections. This is because Setup/Uninstall temporarily disables WOW64 file system redirection when files/directories are accessed by those sections. Elsewhere, System32 and {sys} map to the 32-bit System directory, as is normal in a 32-bit process.

As mentioned is all the references above, you should better use {sys} constant instead of {win}\system32:

Source: "C:\myproject\driver.sys"; DestDir: "{sys}\drivers"

{sys} The system's System32 directory.

For example: If you used {sys}\CTL3D32.DLL on an entry and the system's Windows System directory is "C:\WINDOWS\SYSTEM", Setup or Uninstall will translate it to "C:\WINDOWS\SYSTEM\CTL3D32.DLL".

On 64-bit Windows, by default, the System32 path returned by this constant maps to the directory containing 32-bit system files, just like on 32-bit Windows. (This can be overridden by enabling 64-bit mode.)



标签: inno-setup