Rename directory in installer

I am working on a windows application that should be able to update itself. Clicking the button launches the installer and then displays the parent application. At some point during installation, the installer tries to rename the directory from which the parent application was executed, and the Deny Access fails. If you run the installer from the desktop, it works.

I am using CreateProcess to run the installer, is there a way to use this or another API to create the installer completely independent of the parent application so that it doesn't save any attachment to the directory.

0


source to share


3 answers


I am not sure if running the installer separately will solve your problem. This looks more like a permissions issue that you could solve using ACL manipulation. If your application does not have permissions to work on this folder, you can write your own action to fix the problem by adding the necessary permissions for your process.



Another way to do this is to make sure that directory deletion occurs as part of a custom action that you control (for example, you own / maintain the code that performs the deletion, rather than relying on MsiExec to do it for you). Then set this custom action to run in system context so that it has the same rights as the service. This should give your installer sufficient rights to delete the folder.

+1


source


You must use the regular update system in Windows Setup. your access denied message appears because the file / directory is in use.

renaming directories is also not a good idea. what happened if the user clicks "repair" or "delete"?



you can start msi with shellexec. then terminate the application immediately. you should check that in msi your application no longer works.

update. if the file is in use, the installer automatically wants to reboot to replace the material.

+1


source


CreateProcess should work if you pass correct parameters to it. Don't refer to the parent process and set most things to NULL. If that doesn't work, you can try WinExec ().

+1


source







All Articles