PDA

View Full Version : Delete a locked file during a reboot after an uninstall?



titelee79
11-02-2005, 08:45 PM
Is there a way in Install Shield to tell it to delete a file the next time the computer reboots after an uninstallation?

Our program creates a file and is used/locked by a system process (exe) that is part of our program. When Uninstalling, the IS removes everything, including the exe, except the file that the exe is using. (Until the user reboots or kills the exe in the Processes view of the Task Manager, the file is in use/locked and can't be deleted).

(This file is not included in the installer although, tried including it as well.)

SGorman
11-03-2005, 09:09 AM
have you tried authoring an entry for the (locked) file in the RemoveFile table?
This *should* tell MSI to try to remove the file and when it finds the file is locked it should automatically schedule it up for removal on reboot.

titelee79
11-03-2005, 03:25 PM
Thanks for the reply, I had tried that already. However, I have just realized what is really going on. The file isn't actually locked and does get deleted during uninstallation... But, the system process (exe) that is running until the computer is rebooted, actually recreates the file during shutdown (logs the event). So I guess I need to figure out how to schedule deletes after a shutdown.

Zweitze
11-04-2005, 03:52 AM
I know the Win32 API function: MoveFileEx()
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/movefileex.asp

I don't know whether InstallShield built an InstallScript function around it... if not, call MoveFileEx() yourself.