[Installer] Give FindFirst the two arguments it takes

FindFirst takes the pattern and the output variable and leaves the search
handle in $0. There is no handle argument, and FindNext taking only a variable
is the giveaway: the handle has to live somewhere implicit, and it is $0.

The call passed three arguments, so makensis rejected the script and the CPack
packaging step failed with "Problem running NSIS command" before ever reaching
the required-runtime check.

This was not only a compile error. The handle variable was never populated, so
the stale-runtime check that commit 844a1a9b added could never see a match: it
probed $StaleFindHandle, which stayed empty, and the widened wildcard scan over
the purge set was a no-op. Pass the pattern, test $0, and close $0. No FindNext
is needed, because $R0 is a yes/no flag rather than a list.

Drops the now unused StaleFindHandle Var.
This commit is contained in:
Lukas Brübach 2026-10-02 02:40:12 +02:00
parent a5f3092d6c
commit 55216e0b0a

View file

@ -15,7 +15,6 @@ Var ReinstallMode
Var AllowForceClose
Var GuardDir
Var OldUninstallString
Var StaleFindHandle
Var StaleFindName
Var IsUpgrade
Var AbortReason
@ -686,10 +685,16 @@ Function CheckStaleRuntimeMask
${If} $R0 = 1
Return
${EndIf}
FindFirst $StaleFindHandle $StaleFindName "$INSTDIR\$R3"
${If} $StaleFindHandle != ""
; FindFirst takes the pattern and the name variable only, and leaves the
; search handle in $0 - there is no handle argument and no handle variable
; to keep, which is why FindNext does not take one either. $R3 and $R0 are
; untouched by it, so only $0 is consumed here.
; One match is enough: $R0 is a yes/no flag, not a list, so there is no
; FindNext and nothing to iterate.
FindFirst "$INSTDIR\$R3" $StaleFindName
${If} $0 != ""
StrCpy $R0 1
FindClose $StaleFindHandle
FindClose $0
${EndIf}
FunctionEnd