File/DLL 安装到 {sys} 没有出现在 C:\Windows\system32

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

我不知道为什么,但是当我尝试将文件从我的安装目录复制到 system32 时,它失败了,尽管它在 Inno Setup 中显示为成功安装。这是我的代码:

[Files]
; specifies what files will be included in the installation
Source: "{src}\..\elt.properties"; DestDir: "C:\elt"; Flags: ignoreversion;     BeforeInstall: SetProgressMax(10); 
Source: "{src}\..\msvcr120.dll"; DestDir: {sys}; Flags: onlyifdoesntexist; 

我还想包括我的日志输出,因为我觉得很奇怪,文件的时间太少了,我在 2016 年 7 月 8 日上午 11 点左右写这篇文章

[11:49:36.526]   -- File entry --
[11:49:36.528]   Dest filename: C:\Windows\system32\msvcr120.dll
[11:49:36.529]   Time stamp of our file: 2013-10-04 23:58:24.000
[11:49:36.530]   Installing the file.
[11:49:36.566]   Successfully installed the file.

对于 32 位应用程序(如 Inno Setup),默认情况下 {sys} (system32) is redirected{win}\SysWOW64 OS。

如果您的 DLL 是 32 位的,您实际上需要重定向。 SysWOW64 相当于 Windows 32 位仿真在 Windows 64 位上的 System32。另见 .


如果您不想重定向(因为您的 DLL 是 64 位),您可以使用 64bit flag:

覆盖重定向
Source: "..."; DestDir: "{sys}"; 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.


或启用64-bit mode安装。

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