I wrote this little script to demonstrate problem. It looks beep.sys that should (hopefully) exist on every Windows machine.
I first thought that $SYSDIR could give wrong path to C:\Windows\SysWOW64\drivers but path seems to correct and hardcoding path in script give same results. Why IfFileExists shows such behaviour on 64bit Windows ? Or have I understood something wrong?
Name "beepexist"
OutFile "beepexist.exe"
SetDateSave on
SetDatablockOptimize on
CRCCheck on
SilentInstall normal
XPStyle on
Function .onInit
IfFileExists $SYSDIR\drivers\beep.sys 0 notfound
MessageBox MB_OK "beep.sys found at: $SYSDIR\drivers\"
Goto end
notfound:
MessageBox MB_OK "No beep.sys found at: $SYSDIR\drivers\"
end:
FunctionEnd
Section "-boo"
;
SectionEnd
Best regards