- NSIS Discussion
- Bug with GetFileTime under Win9x
Archive: Bug with GetFileTime under Win9x
smatte
25th October 2005 15:41 UTC
Bug with GetFileTime under Win9x
I used this code :
-----------------------------------
!define LOW1 $0
!deinfe HIGH1 $1
!define LOW2 $2
!deinfe HIGH2 $3
GetFileTime ${FILENAME} ${HIGH1} ${LOW1}
GetFileTimeLocal "c:\program files\local file.dat" ${HIGH2} ${LOW2}
IntCmpU ${HIGH1} ${HIGH2} 0 local_is_newer user_has_newer
; compare lows
IntCmpU ${LOW1} ${LOW2} 0 local_is_newer user_has_newer
; files has the same time
Return
local_is_newer:
; user has an old file, install a newer version
File /oname=${FILENAME} "localfile.dat"
Return
user_has_newer:
; user has a newer version
MessageBox MB_OK "cheater!"
---------------------------------------
But it didn't work under win9x because the low value isn't the same under this OS? Any patch or other way to compare local file and destination file?
kichik
25th October 2005 15:51 UTC
How exactly didn't it work? And why not use SetOverwrite ifnewer?
smatte
26th October 2005 13:51 UTC
What I need is Overwrite ifdiff. But anyway SetOverwrite ifdiff also have a bug under Win9x.
Step to reproduce:
-Install on a clean Win9x machine
-Reinstall the same software(always using SetOverwrite ifdiff)
Result: The file is replaced and if the file was locked, the error flag is set.
Expected: The file is skiped because it is the same.
kichik
27th October 2005 19:52 UTC
The attached script works perfectly fine for me. Can you attach a complete script that shows the problem?
smatte
27th October 2005 20:26 UTC
Don't forgat that the error is only under win9x and ME but works well under WinXP.
Your script is a very good example:
Install for the first time.
Reinstall without uninstalling before.
The file is already present and is not suppose to be replaced. So on win98 you'll see in details window: Extract: Blah.nsi...100%
But on winXP you'll have Skipped: Blah.nsi
Got it? :confused:
kichik
27th October 2005 20:34 UTC
I wrote and tested it on Windows 98. On the first time it was extracted, and on the second, it was skipped. If it's always extracted for you, you might have some program running on the background and altering the timestamps. Maybe an anti-virus or some automatic file scanner?
smatte
27th October 2005 22:29 UTC
OK! now I know...you must compile on WinXp but execute on Win98. If you compile on Win98 you wont get the bug.
kichik
28th October 2005 00:02 UTC
Must be the FAT 2 seconds time resultion. I'll check it out tomorrow.
smatte
28th October 2005 22:49 UTC
This could help you...
http://support.microsoft.com/default...b;en-us;127830
but you seem to already know that.
kichik
29th October 2005 00:01 UTC
There are a few things to think about:
- Should GetLocalFileTime and GetFileTime be affected as well, or should the user implement this at wish?
- Will it be enough to round the time only on the compiler's side? It will work, but it will break backward compatibility. Upgraded installers that already used ifdiff, will install the file once again, but only once. However, this is easier to implement, and can be tuned by some compiler directive.
- Other things I forgot because it's late.
kichik
5th November 2005 14:08 UTC
Made it round the time on the compiler side. Improvements can be added later.