ianamason
19th December 2008 23:49 UTC
Rename /REBOOTOK not working on Vista?
I'm writing an installer to upgrade existing installations,
and rather than do it while things are running, I'm trying
to leave all the action till the next reboot. So I
have a macro like:
!macro UpgradeFile LOCALFILE
GetTempFileName $R1 $INSTDIR
File /oname=$R1 "${LOCALFILE}"
Rename /REBOOTOK $R1 "${LOCALFILE}"
!macroend
and then do things like:
!insertmacro UpgradeFile "file.ext"
Where I am assuming that file.ext is already
there, so the macro just writes out a temp file
then, on reboot, moves it over.
The installer works nicely on XP, but fails to
to work on Vista Business. What happens is on
reboot, I find my temp files just sitting in
the directory, mocking me.
Ideas?
kichik
20th December 2008 07:22 UTC
You must specify a full path instead when using Rename instead of the local path on your computer. You should use the library macros (InstallLib) or the old UpgradeDLL instead of writing your own.
ianamason
20th December 2008 16:40 UTC
Thanks, I'll give that a try.
ianamason
23rd December 2008 21:32 UTC
Problems with Rename /REBOOTOK on Vista
So, rather than use InstallLib, which is overkill for
my problem (these files are not DLLs or libraries), I
have attempted to improve my macro to use full path names:
!macro UpgradeFile LOCALFILE
GetTempFileName $R1 $INSTDIR
File /oname=$R1 "${LOCALFILE}"
GetFullPathName $0 "${LOCALFILE}"
Rename /REBOOTOK $R1 $0
!macroend
On XP the thing, still, works as planned. But
alas on Vista Business, the paths all look correct,
the files are all there, but there has been no
copying action taking place on restart. The installer is
running as user, and the install directory is in
the user's Documents folder, so I would have
thought UAC was not the issue here.
Any more ideas?
kichik
23rd December 2008 22:16 UTC
You must be an administrator to replace files on reboot, so UAC is definitly an issue.
ianamason
23rd December 2008 22:20 UTC
Right, because it is implemented using the HKLM
registry for PendingFileRenameOperations, yes?
Thanks. Time for plan B :igor:
kichik
23rd December 2008 22:35 UTC
Yes, it's implemented using MoveFileEx which in turn uses HKLM.