Skip to content
⌘ NSIS Forum Archive

REBOOTOK: what if file renamed before system restart

5 posts

winman2004#

REBOOTOK: what if file renamed before system restart

If /REBOOTOK is specified and the file cannot be deleted then the file is deleted when the system reboots.

In registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager "PendingFileRenameOperations" key will have values to which file has to be renamed. But if the file is already renamed properly before restart(by any other program) then registry will be still exists, So in this case does it cause any problem after PC restart as registry will be present.
winman2004#
Thank you

In our case i observed that the registry PendingFileRenameOperations contains value such as shown below for rename case.

\??\D:\Desktop\rel1del\Auto.exe.tmu
!\??\D:\Desktop\rel1del\Auto.exe


So how does rebootok work?

I assume that rebootok works by checking for Existence of file Auto.exe.tmu and if exists then deletes the file Auto.exe and then renames Auto.exe.tmu to Auto.exe ?

Also is ! is a separator character?

In case of delete /rebbotok i saw registry such as \??\D:\Desktop\rel1del\Auto.exe

So please explain how does this rebootok works in case of rename and delete?
Afrow UK#
It does not overwrite the destination file if it already exists. You will need to delete the destination file first (with /rebootok too if necessary).

How the actual registry values are stored and read is as good a guess of yours as is mine. IIRC on Windows NT, NSIS just calls the MoveFileEx API with MOVEFILE_DELAY_UNTIL_REBOOT therefore Windows does the renaming on reboot, not NSIS.

Stu
winman2004#
Originally Posted by Afrow UK View Post
It does not overwrite the destination file if it already exists. You will need to delete the destination file first (with /rebootok too if necessary).

Stu
If the source file is not there then does destination file deleted after restart?

That is if Auto.exe.tmu file is not there after restart then does Auto.exe deleted?