While there already is some truth within the comments, I'd like to share what I've learned so far anyway, just in case anyone needs it.
My observations are
- If I use the
Check parameter with a function that returns a boolean, there is no Invalid Prototype error
- If I use the
BeforeInstall or AfterInstall parameter with a procedure there is no error either
- Any other combination will cause the error
This led me to the following conclusion:
When using a procedure or function within the parameters of [Files] entry, Inno Setup creates a prototype for this function or procedure.
- A
procedure prototype for BeforeInstall and AfterInstall, since these do not expect a return value
- A
function : boolean protoype for Check, because this one expects a return value
After processing the [Files] section, the [Code] section is processed. Since a prototype for CheckForFile has already been declared as procedure CheckFile(...); the declaration function CheckFile(...) : boolean does not match the prototype and the error is shown.
Therefor changing the function to a procedure would work techically, but using Check would be the way to go in your case. In cases when we want to execute something before the installation, BeforeInstall is the way to go, but it does not allow returning values.