Skip to content
⌘ NSIS Forum Archive

uninstall.exe and an external way of patching

34 posts

Afrow UK#
I very much doubt the read only flag will stop it being deleted. If the uninstaller is in use, then what I've said applies.

-Stu
coco_vc#
Hi Stu,

Yes, you are right, so I started the uninst.exe with _?= param.

What I have noticed is that the following code works just fine:

Section -Post
ClearErrors
Delete "$EXEDIR\${MY_UNINSTALLER_NAME}"
IfErrors done_err.Post
WriteUninstaller "$EXEDIR\${MY_UNINSTALLER_NAME}"
IfFileExists "$EXEDIR\${MY_UNINSTALLER_NAME}" done.Post 0
done_err.Post:
SetErrorLevel 5
done.Post:
SectionEnd
meaning it returns 5 when the file is in use so Delete fails.

But I would have expected also a return error code for the following code:

Section -Post
ClearErrors
Delete "$EXEDIR\${MY_UNINSTALLER_NAME}"
WriteUninstaller "$EXEDIR\${MY_UNINSTALLER_NAME}"
IfFileExists "$EXEDIR\${MY_UNINSTALLER_NAME}" done.Post 0
done_err.Post:
SetErrorLevel 5
done.Post:
SectionEnd
as I would expect that b/c Delete fails, the running of this exe would return an error code, but actually it returns 0. Why is that?

Thx,
Viv
Afrow UK#
I don't think now that the error flag has anything to do with the error levels.

These are the error levels in the documentation:
0 - Normal execution (no error)
1 - Installation aborted by user (cancel button)
2 - Installation aborted by script

You need to set the error level yourself then like in your first example.

-Stu
coco_vc#
I don't think now that the error flag has anything to do with the error levels.
Yes, this seems to be the case. I wasn't aware of that. I somehow was sure that it will return a value diff than 0 if one instruction fails.

Thx Stu,
Viv