Archive: Rename /REBOOTOK not working on Vista?


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?


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.


Thanks, I'll give that a try.


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?

You must be an administrator to replace files on reboot, so UAC is definitly an issue.


Right, because it is implemented using the HKLM
registry for PendingFileRenameOperations, yes?

Thanks. Time for plan B :igor:


Yes, it's implemented using MoveFileEx which in turn uses HKLM.