Archive: Bug with GetFileTime under Win9x


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?


How exactly didn't it work? And why not use SetOverwrite ifnewer?


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.


The attached script works perfectly fine for me. Can you attach a complete script that shows the problem?


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:


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?


OK! now I know...you must compile on WinXp but execute on Win98. If you compile on Win98 you wont get the bug.


Must be the FAT 2 seconds time resultion. I'll check it out tomorrow.


This could help you...
http://support.microsoft.com/default...b;en-us;127830
but you seem to already know that.


There are a few things to think about:

  1. Should GetLocalFileTime and GetFileTime be affected as well, or should the user implement this at wish?
  2. 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.
  3. Other things I forgot because it's late.

Made it round the time on the compiler side. Improvements can be added later.