2

在安装过程中,我将源的驱动器号 ({drive:src}) 写入 {app}/userinfo.ini 和 {localappdata}/userinfo.ini 文件,这在 WinXP 和 Vista 中运行良好,但在 Win7 和 Win8 中运行良好。在 {app}/userinfo.ini 中,如果源是映射驱动器,则始终写入“C:”,而在 {localappdata}/UserInfo.ini 中,它正在写入源的完整网络路径。我读到Win7和Win8用户的权限不同。那么在这种情况下如何获取映射的驱动器号。

4

1 回答 1

1

You cannot get the mapped drive letter, as the installer runs as an administrator and the drive mappings are different between admin and non-admin levels (even if you think it's the same user -- and it isn't always).

When elevating from regular to admin, Inno automatically translates mapped drive letters to the "real" UNC path, as it would not be able to run at all if it tried to use the letter. Thus {src} will always be a UNC path, and {drive:src} will be the root share name.

You shouldn't be trying to save this information in an admin installation anyway, as different users may have different mappings. You will either need to make your application figure this out itself (and save it in the per-user settings) or you will need to make a per-user installation instead.

于 2014-02-01T06:59:30.903 回答