Deny installation into directory without write permission - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Deny installation into directory without write permission

Hello everyone.

When trying to install into a directory to which one does not have write permission Advanced Installer reports this to the user and quits.

Can this behavior be altered? We would probably prefer to inform the user about the situation and then show FolderDlg again, for example.



With best regards

Clemens Anhuth
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Deny installation into directory without write permission

Hi Clemens,

Please note that this behavior is shown by Windows Installer not by Advanced Installer. Also, this cannot be modified because it is a Windows Installer automatic reaction.
A solution would be to create a custom action which verifies the permissions of the target folder and prompt the user about it, but I'm not sure how this custom action would look like.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Re: Deny installation into directory without write permission

Hello cosmin,

than you for the information.

I would probably simply try to write into the target folder and see if that fails. But I am fuzzy about how to trigger my custom action after the user selected an installation folder, and how to go back (if that should be necessary) to the FolderDlg dialog if the write check fails. Can you shed some light on this?

Thank you.



With best regards

Clemens Anhuth
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Deny installation into directory without write permission

Hi,
I am fuzzy about how to trigger my custom action after the user selected an installation folder, and how to go back (if that should be necessary) to the FolderDlg dialog if the write check fails. Can you shed some light on this?
A good approach is to use an UI Custom Action through a DoAction control event. This control event can be added in the "Published Events" tab for the "Next" button on the "FolderDlg" dialog (in the "Dialogs" page). This way, when the user clicks on the "Next" button, the custom action will be executed.

To make sure that the user cannot proceed with a folder for which he doesn't have write access, you can use a property. The property can be set inside your custom action and then used to condition the "NewDialog" control event used for the "Next" button. When the user will click on "Next", the NewDialog control event will run only if the condition is met, therefore you can stop the user from advancing. You can also show a custom message from your custom action to inform the user why he cannot continue.

Please note that the control events can be managed only in an Enterprise project. If you cannot create this type of projects, the only solution is to run the custom action once and abort the installation if the user doesn't have the appropriate permissions. In this case the custom action can be scheduled under "InstallExecuteSequence" -> "CostFinalize" to make sure that it is executed after the installation folder has been set.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Re: Deny installation into directory without write permission

Hi cosmin,

thank you very much for your detailed reply. I will try this soon.



With best regards

Clemens Anhuth

Return to “Common Problems”