inno-setupmapped-drive

BrowseForFolder Function in Inno Setup Doesn't Show Mapped Drives


I'm using Inno Setup v6.0.5. I want to allow the user to select a folder so I use BrowseForFolder. The problem is that the resulting dialog does not show any mapped drives. It shows the Network folder but on my machine (and presumably others) it won't open for some reason. Is there a way to get the BrowseForFolder dialog to show mapped drives or is there another method that can be used to allow the user to select a path with a mapped drive?


Solution

  • The core of the problem is not that Inno Setup doesn't show mapped drives, but rather that elevated and unelevated processes do not, by default, share mapped drives. see this article:

    Mapped drives are not available from an elevated prompt when UAC is configured to "Prompt for credentials" in Windows (3035277)

    What this KB article is saying, in a convoluted way, is that mapped drives between elevated and non-elevated sessions are not shared. You can tell Windows that you want to share the mappings by setting the EnableLinkedConnections registry value:

    Hive: HKEY_LOCAL_MACHINE
    Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
    Value Name: EnableLinkedConnections
    Value Data: 1
    Data type: REG_DWORD

    Changing this setting requires a reboot, so you can't use it for just your individual installer -- and I don't recommend using a global state to manage a local problem anyway.

    Based on your comment:

    I'm installing data files to the network, the software is installed on their PC. It's the answer if it solves the problem

    It sounds like perhaps you could solve this problem by using a separate user-based installer that only installs the data files: Just use PrivilegesRequired=lowest in the [Setup] section and then the problem of drive mappings never arises.