Archive: How to pass value/parameter to uninstaller.exe


How to pass value/parameter to uninstaller.exe
  Hi all,

Question: How can I pass certain parameters/values to uninstaller.exe?

Description: I need to uninstall a plugin and remove the appropriate information from registry. The problem is that this plugin can be installed multiple times on PC (for a different releases of a certain program).
HKLM SOFTWARE\MyPlugin "SoftwareV1.0" "MyPluginV2.0"
HKLM SOFTWARE\MyPlugin "SoftwareV2.0" "MyPluginV2.0"

The uninstaller should know which key/value should be removed, but I dont have the access to parameteres that were determined while installation (The user decides while installation if he want use the plugin for Software V1.0 or V2.0)

Thanks in advance
LoGGoL
P.S. sorry for my english...


There are many ways to do this.
- Save the information in registry (make a string named after your version number, containing the exact path of your specific uninstall.exe, then in uninstall.exe enumerate all the strings looking for $EXEDIR.)
- Save the information in a inifile (same method, more or less)
- Append the information to the end of uninstall.exe using FileWrite/FileRead (these bytes are not covered by the internal CRC check, so you might want to add a parity byte or something)


Thanks MSG,

I decided to put the a string that contains the full path of the uninstaller into the registry. It works now, but there is a (I guess cosmetique) issue:

How can I remove double backslash from a string?
e.g. C:\HELLO\\WORLD

Sometimes the rootpath entry in registry contains a backslash at the end and sometimes not. How can I remove it if it exist?

thanks


Are you reading the path directly into $INSTDIR? It should automatically strip trailing back strokes if you do.

E.g.
ReadRegStr $INSTDIR ...
StrCpy $INSTDIR $INSTDIR\MyDirectory

Stu


Or for the more general case:


spaces from a string

>; _outvar is the variable to write to, _input is any string.
;
; Example:
; StrCpy $2 "c:\program files\longpath\"
; ${RemoveTrailingBackslashSpaces} $3 $2
; # $2 is now: c:\program files\longpath\
; # $3 is now: c:\program files\longpath
!macro _RemoveTrailingBackslashSpaces _outvar _input
Push $R0
Push $R1
StrCpy $R0 "
${_input}"
StrCpy $R1 $R0 1 -1
StrCmp $R1 '\' +2
StrCmp $R1 ' ' 0 +3
StrCpy $R0 $R0 -1
goto -4
Push $R0
Exch 2
pop $R0
pop $R1
pop ${_outvar}
!macroend
!define RemoveTrailingBackslashSpaces `!insertmacro _RemoveTrailingBackslashSpaces`
>

An alternative:

DetailPrint $R0 ; "C:\path\ \ \\"

Push $R0
Exch $INSTDIR
Exch $INSTDIR
Pop $R0

DetailPrint $R0 ; "C:\path"

Stu


Yeah, for paths specifically that's probably the better idea.


Indeed, I solved this using GetParent and GetFileName, but the alternative using Push and Exch is much better.

StrCpy $0 "C:\Path\\\"
${GetParent} $0 $R0
${GetFileName} $0 $R1
StrCpy $0 "$R0\$R1"

Many thanks!