Archive: Debugging Uninstaller


Debugging Uninstaller
Hello guys

I have little problem with my app
I added functionality to the uninstaller to check if the application is running

        Function un.Leave_PageConfirm
Pop $0
Pop $1
${do}
retry1:
retry2:
!insertmacro un.FindProcess "AVLDrive.exe" $0
${if} $0 <> 0
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "$(UN.TEXT_DRIVE_RUNNING)" IDRETRY retry1
Abort
${endif}
!insertmacro un.FindProcess "Reportgenerator.exe" $0
${if} $0 <> 0
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "$(UN.TEXT_RG_RUNNING)" IDRETRY retry2
Abort
${endif}
${LoopWhile} 0 <> $0
Push $1
Push $0
FunctionEnd

It works, but if you press cancel on the messagebox and then cancel on the uninstaller i get the error
Installer corrupted: invalid opcode
If I put everythin in a tiny testinstaller (see attachment) it works, but not in my big app

How can I find the error?
Or even better: Does somebody have a clue what I'm doing wrong?

I am going to take a total stab in the dark here and am probably wrong, but it may be a stack corruption issue. Between your two files provided in the example.zip, there is a lot of stack manipulation.

In your function "un.Leave_PageConfirm" if the user chooses "cancel" you Abort. However, you haven't restored the stack by calling Push $1 and Push $0 before the Abort happens. Maybe by simply restoring the stack before aborting, your error will go away. Again, this is a stab in the dark and may be completely off (I am by no means an expert at this), so feel free to roll your eyes and disregard :). It just seems suspicious that this happens only when the user cancels (hence the abort).


thanks for the tip

i'm going to try it after the holidays.....


You probably want to push at the beginning, then pop when you're done.


Originally posted by MSG
You probably want to push at the beginning, then pop when you're done.
This was exactly the problem!
Thanks for the tipp!