Skip to content
⌘ NSIS Forum Archive

How to append custom data to the uninstaller?

5 posts

M-Force#

How to append custom data to the uninstaller?

Hi,
I want to append data to the unistaller in order to reuse the data which i defined in the installer. I want to avoid creating an ini file or using the registry for storing such data.

My question now is how to do that in detail.

Can somebody help me with that?

M.
Anders#
you can append data to the end of the uninstaller exe after it has been created, use FileSeek
and FileWriteByte
M-Force#
Do you have an example how such script code is suppose to look like? I mean how can i append data to the uninstaller file and how can i read the data back in a script? And where in the installer should i write the data?

Thanks for your help.

M.
galil#edited
Name "${__FILE__}"
OutFile "${__FILE__}.exe"
ShowInstDetails show
InstallDir "$EXEDIR"

!define Uninstaller "$INSTDIR\uninst_${__FILE__}.exe"

!include "TextFunc.nsh"
!insertmacro un.FileReadFromEnd

Var Poo
;...

Section ""
;...
WriteUninstaller ${Uninstaller}
StrCpy $Poo "Poopies=1"
;...
FileOpen $0 ${Uninstaller} a
FileSeek $0 1 END
FileWrite $0 $Poo
;...
FileClose $0
SectionEnd

Section "Uninstall"
;
${un.FileReadFromEnd} ${Uninstaller} un.ReadMyStuff
Delete ${Uninstaller}
;
SectionEnd

Function un.ReadMyStuff
MessageBox MB_OK '$9'
StrCpy $0 StopFileReadFromEnd
Push $0
FunctionEnd