Mottel
10th December 2002 05:20 UTC
Bug report (Rename on reboot)
Rename on reboot doesn’t seem to work properly (at least under Win98 SE and NSIS 2.0b0, CVS 2002-11-30).
Under Win98, NSIS' Delete on reboot and Rename on reboot work by writing a string to $WINDIR\WININIT.INI. Upon boot-up, this file is read by Wininit.exe, which displays the boot-screen messages:
"Please wait while Setup updates your configuration files. This may take a few minutes," etc.
(BTW, does anyone know how this is implemented under newer versions of Windows (e.g. XP) which don't boot to DOS initially? AFAIK, they don't use Wininit.exe, which is a DOS .exe.)
The NSIS documentation on the Delete instruction warns that filename should be specified with a full path.
(This ensures that when using Delete /REBOOTOK for a file that can't be overwritten, the entry in Wininit.ini, which takes the form:
[Rename]
NUL=filename
will correctly find the specified file.)
The documentation on the Rename instruction says nothing about the need to specify filename with a full path. However, even when using:
Rename /REBOOTOK FullPath\SourceFile FullPath\DestinationFile,
if the source file is in use and cannot be overwritten, the entry written to Wininit.ini takes the form:
[Rename]
=FullPath\SourceFile
(with nothing to the left of the equal sign.)
(and, note: the SOURCEfile appears to the RIGHT of the equal sign.)
The result is that the Rename upon reboot does not work.
kichik
10th December 2002 16:59 UTC
It always makes me feel good when people find bugs from veresion previous to 2 because then I know more and more people are using NSIS to more and more things :D
This bug goes all the way back to NSIS 1.2f!!! That's a year and a half! :eek:
To reproduce the bug all you need to do is rename an existing file that is in use to a name that does not exist. When doing this on Windows 9x NSIS can't find the short name of a non existing files so it puts nothing, an empty string, instead.
In Windows NT (NT/2000/XP) NSIS uses the more powerful MoveFileEx that supports file names that are not 8.3 (DOS format) so there is no such problem.
I will do my best to fix this ASAP, not that anyone but you will notice... Nobody have noticed it for a year and a half! ROFL :D
BTW Mottel, like Joost said in another post, 2002-11-30 is an old version. Go download 2.0b0, some bugs were fixed prior to the release.
kichik
10th December 2002 17:20 UTC
OK, fixed in latest CVS version. It now creats the file if it's not already there.
Mottel
11th December 2002 00:46 UTC
It always makes me feel good when people find bugs from veresion previous to 2 because then I know more and more people are using NSIS to more and more things
(Glad to help.) I'm actually doing something rather interesting with NSIS that may be useful to others. I hope to post some preliminary results here in about 2-3 weeks.
To reproduce the bug all you need to do is rename an existing file that is in use to a name that does not exist. When doing this on Windows 9x NSIS can't find the short name of a non existing files so it puts nothing, an empty string, instead.
Some more info relevant to testing this sort of thing: A file can be "in use" and still be overwritten! It depends on what is using it. If you open a text file in Notepad, Windows will happily overwrite it. If you open it in Word, it won't. (I guess it depends on whether the individual program that is using the file locks it or not.)
In Windows NT (NT/2000/XP) NSIS uses the more powerful MoveFileEx that supports file names that are not 8.3 (DOS format) so there is no such problem.
I assume that while the PC is off, even Win2000/XP can't remember stuff to do upon reboot, so it would have to write it to a file that is read upon bootup. I've checked on a friend's XP machine, and I know it doesn't have a Wininit.exe. What file does it write, and what program reads the file upon bootup?
BTW Mottel, like Joost said in another post, 2002-11-30 is an old version. Go download 2.0b0, some bugs were fixed prior to the release.
Wow! Looks like a lot can happen in a week over there at CVS, when you're not looking! I take it that 2.0b0 is now an "official" (albeit Beta) release. :up:
OK, fixed in latest CVS version. It now creates the file if it's not already there.
Thanks. :up: I'm not a C programmer, so I don't have the tools to recompile NSIS, and I noticed on the CVS log-page that the latest Makensis.exe (1.120, Dec 7, 09:59 GMT) predates your bug fix (Dec 10) so could you please recompile it to incorporate this fix? :) I'll then download the release from the next nightly snapshot.
kichik
11th December 2002 14:46 UTC
Windows NT/2000/XP saves the information in the registry. You can find more information on it in the MSDN page about MoveFileEx: http://msdn.microsoft.com/library/en...movefileex.asp
Compiled version uploaded.