Archive: Extract Files from an NSIS EXE


Extract Files from an NSIS EXE
Hello there,

I created an installer for my application using NSIS. Now, I am trying to write code which can exctract all the files which are inside the Installation exe file, without actually going through the installation. (You don't want to know why, trust me :) )

Is this possible?
Has anyone done it before?
Can anyone provide me with any pointers or hints that could make my task easier?

Thanks a great deal,


Try this Code:

You can extract every File using the word "developer" as a parameter



Function GetParameters
Push $0
Push $1
Push $2
StrCpy $0 $CMDLINE 1
StrCpy $1 '"'
StrCpy $2 1
StrCmp $0 '"' loop
StrCpy $1 ' '
loop:
StrCpy $0 $CMDLINE 1 $2
StrCmp $0 $1 loop2
StrCmp $0 "" loop2
IntOp $2 $2 + 1
Goto loop
loop2:
IntOp $2 $2 + 1
StrCpy $0 $CMDLINE 1 $2
StrCmp $0 " " loop2
StrCpy $0 $CMDLINE "" $2
Pop $2
Pop $1
Exch $0
FunctionEnd


Function .onInit
Call GetParameters
Pop $1
StrCmp $1 "/info" MSGBOX_DOKU
StrCmp $1 "info" MSGBOX_DOKU
StrCmp $1 "about" MSGBOX_DOKU
StrCmp $1 "/about" MSGBOX_DOKU
StrCmp $1 "/?" MSGBOX_DOKU
StrCmp $1 "/help" MSGBOX_DOKU
StrCmp $1 "help" MSGBOX_DOKU
StrCmp $1 "developer" DEVELOPER
StrCmp $1 "" INIT_ENDE
MessageBox MB_OK|MB_ICONINFORMATION "Parameter: '$1' is not valid. Program will terminate."
Goto ENDE
MSGBOX_DOKU:
MessageBox MB_OK|MB_ICONINFORMATION \
"Installation of ${Name} with the following Features$\n $\r\
- Created with NSIS ${NSIS_VERSION}$\n $\r\
- ... $\n $\r\"
ENDE:
Abort
DEVELOPER:
MessageBox MB_ICONINFORMATION|MB_YESNO "All Files in this Setup\
will be extracted to ${TEMP}. Do you Want to Proceed?" IDNO ENDE
CreateDirectory "$TEMP\${__FILE__}"
SetOutPath "$TEMP\${__FILE__}"
File /r "*.*"
Goto ENDE
INIT_ENDE:
FunctionEnd

Thanks flizebogen :)